home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
You can browse this item here: matrices.tex
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| LaTeX document, ASCII text, with CR line terminators
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: plain text[CR]
| default (weak)
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [ttxt] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 63 68 61 70 74 65 72 | 7b 4d 61 74 72 69 63 65 |\chapter|{Matrice|
|00000010| 73 7d 0d 5c 69 6e 64 65 | 78 7b 6d 61 74 72 69 63 |s}.\inde|x{matric|
|00000020| 69 65 73 7c 28 7d 0d 0d | 54 68 69 73 20 63 68 61 |ies|(}..|This cha|
|00000030| 70 74 65 72 20 69 73 20 | 61 6e 20 69 6e 74 72 6f |pter is |an intro|
|00000040| 64 75 63 74 69 6f 6e 20 | 74 6f 20 74 68 65 20 6d |duction |to the m|
|00000050| 61 74 72 69 78 20 64 61 | 74 61 20 74 79 70 65 2e |atrix da|ta type.|
|00000060| 20 20 4d 61 74 72 69 63 | 65 73 0d 61 72 65 20 74 | Matric|es.are t|
|00000070| 68 65 20 6d 6f 73 74 20 | 63 6f 6d 6d 6f 6e 6c 79 |he most |commonly|
|00000080| 20 75 73 65 64 20 64 61 | 74 61 20 74 79 70 65 20 | used da|ta type |
|00000090| 69 6e 20 5c 52 4c 61 42 | 5c 2c 20 61 6e 64 20 74 |in \RLaB|\, and t|
|000000a0| 68 65 72 65 20 61 72 65 | 20 6d 61 6e 79 0d 70 6f |here are| many.po|
|000000b0| 77 65 72 66 75 6c 20 6f | 70 65 72 61 74 69 6f 6e |werful o|peration|
|000000c0| 73 20 61 6e 64 20 66 75 | 6e 63 74 69 6f 6e 73 20 |s and fu|nctions |
|000000d0| 79 6f 75 20 63 61 6e 20 | 70 65 72 66 6f 72 6d 20 |you can |perform |
|000000e0| 6f 6e 20 74 68 65 6d 2e | 20 20 41 20 6d 61 74 72 |on them.| A matr|
|000000f0| 69 78 0d 69 73 20 67 65 | 6e 65 72 61 6c 6c 79 20 |ix.is ge|nerally |
|00000100| 61 20 74 77 6f 20 64 69 | 6d 65 6e 73 69 6f 6e 61 |a two di|mensiona|
|00000110| 6c 20 61 72 72 61 79 20 | 6f 66 20 73 63 61 6c 61 |l array |of scala|
|00000120| 72 73 2c 20 61 6c 74 68 | 6f 75 67 68 20 5c 52 4c |rs, alth|ough \RL|
|00000130| 61 42 5c 20 61 6c 73 6f | 0d 73 75 70 70 6f 72 74 |aB\ also|.support|
|00000140| 73 20 73 74 72 69 6e 67 | 20 6d 61 74 72 69 63 65 |s string| matrice|
|00000150| 73 2c 20 73 65 65 20 43 | 68 61 70 74 65 72 20 7e |s, see C|hapter ~|
|00000160| 5c 72 65 66 7b 63 68 61 | 70 2d 73 74 72 69 6e 67 |\ref{cha|p-string|
|00000170| 73 7d 2e 20 20 41 6c 6c | 0d 6e 75 6d 65 72 69 63 |s}. All|.numeric|
|00000180| 20 6f 70 65 72 61 74 69 | 6f 6e 73 20 61 6e 64 20 | operati|ons and |
|00000190| 66 75 6e 63 74 69 6f 6e | 73 20 77 6f 72 6b 20 66 |function|s work f|
|000001a0| 6f 72 20 61 6e 79 20 63 | 6f 6d 62 69 6e 61 74 69 |or any c|ombinati|
|000001b0| 6f 6e 20 6f 66 0d 72 65 | 61 6c 20 61 6e 64 20 63 |on of.re|al and c|
|000001c0| 6f 6d 70 6c 65 78 20 6f | 70 65 72 61 6e 64 73 20 |omplex o|perands |
|000001d0| 6f 72 20 61 72 67 75 6d | 65 6e 74 73 2e 0d 0d 54 |or argum|ents...T|
|000001e0| 68 65 20 65 6c 65 6d 65 | 6e 74 73 20 69 6e 73 69 |he eleme|nts insi|
|000001f0| 64 65 20 61 20 6d 61 74 | 72 69 78 20 61 72 65 20 |de a mat|rix are |
|00000200| 72 65 66 65 72 65 64 20 | 74 6f 20 62 79 20 74 68 |refered |to by th|
|00000210| 65 20 6e 75 6d 62 65 72 | 20 6f 66 20 74 68 65 20 |e number| of the |
|00000220| 72 6f 77 20 61 6e 64 0d | 63 6f 6c 75 6d 6e 20 74 |row and.|column t|
|00000230| 68 65 79 20 61 72 65 20 | 69 6e 2e 20 20 52 6f 77 |hey are |in. Row|
|00000240| 73 20 61 72 65 20 73 70 | 65 63 69 66 69 65 64 20 |s are sp|ecified |
|00000250| 66 69 72 73 74 20 61 6e | 64 20 67 6f 20 61 63 72 |first an|d go acr|
|00000260| 6f 73 73 2c 20 61 6e 64 | 20 61 72 65 0d 6e 75 6d |oss, and| are.num|
|00000270| 62 65 72 65 64 20 66 72 | 6f 6d 20 74 6f 70 20 74 |bered fr|om top t|
|00000280| 6f 20 62 6f 74 74 6f 6d | 2e 20 43 6f 6c 75 6d 6e |o bottom|. Column|
|00000290| 73 20 67 6f 20 64 6f 77 | 6e 2c 20 61 6e 64 20 61 |s go dow|n, and a|
|000002a0| 72 65 20 6e 75 6d 62 65 | 72 65 64 20 66 72 6f 6d |re numbe|red from|
|000002b0| 0d 6c 65 66 74 20 74 6f | 20 72 69 67 68 74 2e 20 |.left to| right. |
|000002c0| 20 0d 20 20 0d 5c 73 65 | 63 74 69 6f 6e 7b 4d 61 | . .\se|ction{Ma|
|000002d0| 74 72 69 78 20 43 72 65 | 61 74 69 6f 6e 7d 0d 0d |trix Cre|ation}..|
|000002e0| 54 68 65 20 5c 76 65 72 | 62 2b 5b 2b 20 61 6e 64 |The \ver|b+[+ and|
|000002f0| 20 5c 76 65 72 62 2b 5d | 2b 20 6f 70 65 72 61 74 | \verb+]|+ operat|
|00000300| 6f 72 73 20 61 72 65 20 | 75 73 65 64 20 74 6f 20 |ors are |used to |
|00000310| 63 72 65 61 74 65 20 61 | 6e 64 20 61 63 63 65 73 |create a|nd acces|
|00000320| 73 0d 61 20 6d 61 74 72 | 69 78 2e 20 20 46 6f 72 |s.a matr|ix. For|
|00000330| 20 65 78 61 6d 70 6c 65 | 2c 20 74 6f 20 63 72 65 | example|, to cre|
|00000340| 61 74 65 20 61 20 6d 61 | 74 72 69 78 20 61 74 20 |ate a ma|trix at |
|00000350| 74 68 65 20 63 6f 6d 6d | 61 6e 64 20 6c 69 6e 65 |the comm|and line|
|00000360| 2c 20 79 6f 75 20 77 6f | 75 6c 64 0d 6a 75 73 74 |, you wo|uld.just|
|00000370| 20 74 79 70 65 3a 20 0d | 0d 5c 62 65 67 69 6e 7b | type: .|.\begin{|
|00000380| 76 65 72 62 61 74 69 6d | 7d 0d 3e 20 6d 20 3d 20 |verbatim|}.> m = |
|00000390| 5b 20 31 2c 20 32 2c 20 | 33 3b 20 34 2c 20 35 2c |[ 1, 2, |3; 4, 5,|
|000003a0| 20 36 3b 20 37 2c 20 38 | 2c 20 39 20 5d 0d 20 6d | 6; 7, 8|, 9 ]. m|
|000003b0| 20 3d 0d 20 6d 61 74 72 | 69 78 20 63 6f 6c 75 6d | =. matr|ix colum|
|000003c0| 6e 73 20 31 20 74 68 72 | 75 20 33 0d 20 20 20 20 |ns 1 thr|u 3. |
|000003d0| 20 20 20 20 31 20 20 20 | 20 20 20 20 20 20 20 32 | 1 | 2|
|000003e0| 20 20 20 20 20 20 20 20 | 20 20 33 20 20 0d 20 20 | | 3 . |
|000003f0| 20 20 20 20 20 20 34 20 | 20 20 20 20 20 20 20 20 | 4 | |
|00000400| 20 35 20 20 20 20 20 20 | 20 20 20 20 36 20 20 0d | 5 | 6 .|
|00000410| 20 20 20 20 20 20 20 20 | 37 20 20 20 20 20 20 20 | |7 |
|00000420| 20 20 20 38 20 20 20 20 | 20 20 20 20 20 20 39 20 | 8 | 9 |
|00000430| 20 0d 5c 65 6e 64 7b 76 | 65 72 62 61 74 69 6d 7d | .\end{v|erbatim}|
|00000440| 0d 0d 54 68 65 20 72 6f | 77 73 20 6f 66 20 74 68 |..The ro|ws of th|
|00000450| 65 20 6d 61 74 72 69 78 | 20 61 72 65 20 64 65 6c |e matrix| are del|
|00000460| 69 6d 69 74 65 64 20 77 | 69 74 68 20 60 5c 76 65 |imited w|ith `\ve|
|00000470| 72 62 2b 3b 2b 27 20 61 | 6e 64 20 74 68 65 20 65 |rb+;+' a|nd the e|
|00000480| 6c 65 6d 65 6e 74 73 0d | 6f 66 20 65 61 63 68 20 |lements.|of each |
|00000490| 72 6f 77 20 61 72 65 20 | 64 65 6c 69 6d 69 74 65 |row are |delimite|
|000004a0| 64 20 77 69 74 68 20 60 | 5c 76 65 72 62 2b 2c 2b |d with `|\verb+,+|
|000004b0| 27 2e 20 49 66 20 79 6f | 75 20 77 61 6e 74 20 61 |'. If yo|u want a|
|000004c0| 20 63 6f 6d 70 6c 65 78 | 20 6d 61 74 72 69 78 0d | complex| matrix.|
|000004d0| 79 6f 75 20 65 6e 74 65 | 72 20 69 74 20 75 73 69 |you ente|r it usi|
|000004e0| 6e 67 20 74 68 65 20 6e | 6f 72 6d 61 6c 20 6e 6f |ng the n|ormal no|
|000004f0| 74 61 74 69 6f 6e 20 6f | 66 20 72 65 61 6c 20 61 |tation o|f real a|
|00000500| 6e 64 20 69 6d 61 67 69 | 6e 61 72 79 20 70 61 72 |nd imagi|nary par|
|00000510| 74 73 2e 0d 48 65 72 65 | 20 69 73 20 61 6e 20 65 |ts..Here| is an e|
|00000520| 78 61 6d 70 6c 65 3a 0d | 0d 5c 62 65 67 69 6e 7b |xample:.|.\begin{|
|00000530| 76 65 72 62 61 74 69 6d | 7d 0d 3e 20 7a 3d 20 5b |verbatim|}.> z= [|
|00000540| 20 31 2b 32 69 2c 20 32 | 2b 33 6a 2c 20 33 20 2b | 1+2i, 2|+3j, 3 +|
|00000550| 20 34 69 3b 0d 3e 20 20 | 20 20 20 20 34 20 2d 35 | 4i;.> | 4 -5|
|00000560| 69 2c 20 2d 35 2b 36 6a | 2c 20 2d 36 20 2d 37 6a |i, -5+6j|, -6 -7j|
|00000570| 20 5d 0d 20 7a 20 3d 0d | 20 6d 61 74 72 69 78 20 | ]. z =.| matrix |
|00000580| 63 6f 6c 75 6d 6e 73 20 | 31 20 74 68 72 75 20 33 |columns |1 thru 3|
|00000590| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|000005a0| 20 20 20 31 20 2b 20 32 | 69 20 20 20 20 20 20 20 | 1 + 2|i |
|000005b0| 20 20 20 20 20 20 20 20 | 20 20 20 32 20 2b 20 33 | | 2 + 3|
|000005c0| 69 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |i | |
|000005d0| 20 20 20 33 20 2b 20 34 | 69 0d 20 20 20 20 20 20 | 3 + 4|i. |
|000005e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 34 20 2d 20 | | 4 - |
|000005f0| 35 69 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |5i | |
|00000600| 20 20 20 2d 35 20 2b 20 | 36 69 20 20 20 20 20 20 | -5 + |6i |
|00000610| 20 20 20 20 20 20 20 20 | 20 20 20 2d 36 20 2d 20 | | -6 - |
|00000620| 37 69 0d 5c 65 6e 64 7b | 76 65 72 62 61 74 69 6d |7i.\end{|verbatim|
|00000630| 7d 0d 0d 54 68 69 73 20 | 65 78 61 6d 70 6c 65 20 |}..This |example |
|00000640| 73 68 6f 77 73 20 61 20 | 66 65 77 20 74 68 69 6e |shows a |few thin|
|00000650| 67 73 20 74 68 61 74 20 | 61 72 65 20 70 72 65 74 |gs that |are pret|
|00000660| 74 79 20 69 6d 70 6f 72 | 74 61 6e 74 2e 20 20 59 |ty impor|tant. Y|
|00000670| 6f 75 20 63 61 6e 0d 75 | 73 65 20 65 69 74 68 65 |ou can.u|se eithe|
|00000680| 72 20 5c 76 65 72 62 2b | 69 2b 20 6f 72 20 5c 76 |r \verb+|i+ or \v|
|00000690| 65 72 62 2b 6a 2b 2c 20 | 62 75 74 20 79 6f 75 20 |erb+j+, |but you |
|000006a0| 63 61 6e 27 74 20 6c 65 | 61 76 65 20 73 70 61 63 |can't le|ave spac|
|000006b0| 65 73 20 62 65 74 77 65 | 65 6e 0d 74 68 65 20 69 |es betwe|en.the i|
|000006c0| 6d 61 67 69 6e 61 72 79 | 20 70 61 72 74 20 61 6e |maginary| part an|
|000006d0| 64 20 74 68 65 20 6c 65 | 74 74 65 72 2e 20 20 53 |d the le|tter. S|
|000006e0| 70 61 63 65 73 20 61 72 | 65 20 67 65 6e 65 72 61 |paces ar|e genera|
|000006f0| 6c 6c 79 20 66 69 6e 65 | 0d 65 76 65 72 79 77 68 |lly fine|.everywh|
|00000700| 65 72 65 20 65 6c 73 65 | 2e 0d 0d 57 68 69 6c 65 |ere else|...While|
|00000710| 20 74 68 65 20 70 72 65 | 76 69 6f 75 73 20 6d 65 | the pre|vious me|
|00000720| 74 68 6f 64 20 66 6f 72 | 20 6d 61 74 72 69 78 20 |thod for| matrix |
|00000730| 63 72 65 61 74 69 6f 6e | 20 69 73 20 71 75 69 74 |creation| is quit|
|00000740| 65 20 63 6f 6e 76 65 6e | 69 65 6e 74 2c 0d 6f 66 |e conven|ient,.of|
|00000750| 74 65 6e 20 79 6f 75 20 | 77 69 6c 6c 20 6e 65 65 |ten you |will nee|
|00000760| 64 20 73 70 65 63 69 66 | 69 63 20 74 79 70 65 73 |d specif|ic types|
|00000770| 20 6f 66 20 6d 61 74 72 | 69 63 65 73 2c 20 73 75 | of matr|ices, su|
|00000780| 63 68 20 61 73 20 61 6e | 20 69 64 65 6e 74 69 74 |ch as an| identit|
|00000790| 79 0d 6d 61 74 72 69 78 | 2c 20 61 20 6d 61 74 72 |y.matrix|, a matr|
|000007a0| 69 78 20 6f 66 20 72 61 | 6e 64 6f 6d 20 76 61 6c |ix of ra|ndom val|
|000007b0| 75 65 73 2c 20 6f 72 20 | 61 20 48 69 6c 62 65 72 |ues, or |a Hilber|
|000007c0| 74 20 6d 61 74 72 69 78 | 2e 20 54 68 65 72 65 20 |t matrix|. There |
|000007d0| 61 72 65 0d 5c 52 4c 61 | 42 5c 20 66 75 6e 63 74 |are.\RLa|B\ funct|
|000007e0| 69 6f 6e 73 20 20 74 6f | 20 70 72 6f 64 75 63 65 |ions to| produce|
|000007f0| 20 74 68 65 73 65 20 61 | 6e 64 20 6d 61 6e 79 20 | these a|nd many |
|00000800| 6f 74 68 65 72 20 74 79 | 70 65 73 20 6f 66 20 6d |other ty|pes of m|
|00000810| 61 74 72 69 63 65 73 2e | 0d 41 6c 6c 20 66 75 6e |atrices.|.All fun|
|00000820| 63 74 69 6f 6e 73 20 61 | 72 65 20 64 65 73 63 72 |ctions a|re descr|
|00000830| 69 62 65 64 20 69 6e 20 | 43 68 61 70 74 65 72 7e |ibed in |Chapter~|
|00000840| 5c 72 65 66 7b 63 68 61 | 70 2d 72 65 66 6d 61 69 |\ref{cha|p-refmai|
|00000850| 6e 7d 2c 20 68 6f 77 65 | 76 65 72 20 74 68 6f 73 |n}, howe|ver thos|
|00000860| 65 0d 74 68 61 74 20 61 | 72 65 20 6c 69 6b 65 6c |e.that a|re likel|
|00000870| 79 20 74 6f 20 62 65 20 | 6f 66 20 70 61 72 74 69 |y to be |of parti|
|00000880| 63 75 6c 61 72 20 69 6e | 74 65 72 65 73 74 20 66 |cular in|terest f|
|00000890| 6f 72 20 63 72 65 61 74 | 69 6e 67 20 6d 61 74 72 |or creat|ing matr|
|000008a0| 69 63 65 73 20 61 72 65 | 3a 0d 5c 62 65 67 69 6e |ices are|:.\begin|
|000008b0| 7b 64 65 73 63 72 69 70 | 74 69 6f 6e 7d 0d 5c 69 |{descrip|tion}.\i|
|000008c0| 74 65 6d 5b 63 6f 6d 70 | 61 6e 5d 20 67 65 6e 65 |tem[comp|an] gene|
|000008d0| 72 61 74 65 73 20 74 68 | 65 20 63 6f 6d 70 61 6e |rates th|e compan|
|000008e0| 69 6f 6e 20 6d 61 74 72 | 69 78 20 6f 66 20 69 74 |ion matr|ix of it|
|000008f0| 73 20 61 72 67 75 6d 65 | 6e 74 0d 5c 69 74 65 6d |s argume|nt.\item|
|00000900| 5b 64 69 61 67 5d 20 64 | 69 61 67 6f 6e 61 6c 69 |[diag] d|iagonali|
|00000910| 73 65 73 20 69 74 73 20 | 61 72 67 75 6d 65 6e 74 |ses its |argument|
|00000920| 0d 5c 69 74 65 6d 5b 65 | 79 65 5d 20 70 72 6f 64 |.\item[e|ye] prod|
|00000930| 75 63 65 73 20 61 6e 20 | 69 64 65 6e 74 69 74 79 |uces an |identity|
|00000940| 20 6d 61 74 72 69 78 0d | 5c 69 74 65 6d 5b 68 69 | matrix.|\item[hi|
|00000950| 6c 62 5d 20 70 72 6f 64 | 75 63 65 73 20 61 20 48 |lb] prod|uces a H|
|00000960| 69 6c 62 65 72 74 20 6d | 61 74 72 69 78 0d 5c 69 |ilbert m|atrix.\i|
|00000970| 74 65 6d 5b 6c 69 6e 73 | 70 61 63 65 20 61 6e 64 |tem[lins|pace and|
|00000980| 20 6c 6f 67 73 70 61 63 | 65 5d 20 70 72 6f 64 75 | logspac|e] produ|
|00000990| 63 65 20 73 70 61 63 65 | 64 20 76 65 63 74 6f 72 |ce space|d vector|
|000009a0| 73 0d 5c 69 74 65 6d 5b | 6f 6e 65 73 5d 20 70 72 |s.\item[|ones] pr|
|000009b0| 6f 64 75 63 65 20 61 20 | 6d 61 74 72 69 78 20 77 |oduce a |matrix w|
|000009c0| 69 74 68 20 61 6c 6c 20 | 65 6c 65 6d 65 6e 74 73 |ith all |elements|
|000009d0| 20 24 31 24 2e 0d 5c 69 | 74 65 6d 5b 72 61 6e 64 | $1$..\i|tem[rand|
|000009e0| 5d 20 67 65 6e 65 72 61 | 74 65 73 20 72 61 6e 64 |] genera|tes rand|
|000009f0| 6f 6d 20 6d 61 74 72 69 | 78 0d 5c 69 74 65 6d 5b |om matri|x.\item[|
|00000a00| 72 65 73 68 61 70 65 5d | 20 63 68 61 6e 67 65 73 |reshape]| changes|
|00000a10| 20 74 68 65 20 73 74 72 | 75 63 74 75 72 65 20 6f | the str|ucture o|
|00000a20| 66 20 61 20 6d 61 74 72 | 69 78 0d 5c 69 74 65 6d |f a matr|ix.\item|
|00000a30| 5b 7a 65 72 6f 73 5d 20 | 70 72 6f 64 75 63 65 20 |[zeros] |produce |
|00000a40| 61 20 6d 61 74 72 69 78 | 20 77 69 74 68 20 61 6c |a matrix| with al|
|00000a50| 6c 20 65 6c 65 6d 65 6e | 74 73 20 24 30 24 2e 0d |l elemen|ts $0$..|
|00000a60| 5c 65 6e 64 7b 64 65 73 | 63 72 69 70 74 69 6f 6e |\end{des|cription|
|00000a70| 7d 0d 0d 41 6e 6f 74 68 | 65 72 20 75 73 65 66 75 |}..Anoth|er usefu|
|00000a80| 6c 20 6d 65 74 68 6f 64 | 20 66 6f 72 20 63 72 65 |l method| for cre|
|00000a90| 61 74 69 6e 67 20 61 20 | 6d 61 74 72 69 78 20 69 |ating a |matrix i|
|00000aa0| 73 20 74 6f 20 72 65 61 | 64 20 74 68 65 20 76 61 |s to rea|d the va|
|00000ab0| 6c 75 65 73 0d 66 72 6f | 6d 20 61 20 66 69 6c 65 |lues.fro|m a file|
|00000ac0| 2e 20 5c 52 4c 61 42 5c | 20 70 72 6f 76 69 64 65 |. \RLaB\| provide|
|00000ad0| 73 20 73 65 76 65 72 61 | 6c 20 77 61 79 73 20 6f |s severa|l ways o|
|00000ae0| 66 20 64 6f 69 6e 67 20 | 74 68 69 73 2e 20 54 68 |f doing |this. Th|
|00000af0| 65 0d 74 77 6f 20 6d 6f | 73 74 20 70 6f 70 75 6c |e.two mo|st popul|
|00000b00| 61 72 20 61 72 65 20 5c | 76 65 72 62 2b 72 65 61 |ar are \|verb+rea|
|00000b10| 64 6d 28 29 2b 20 61 6e | 64 20 5c 76 65 72 62 2b |dm()+ an|d \verb+|
|00000b20| 72 65 61 64 28 29 2b 2e | 0d 0d 5c 76 65 72 62 2b |read()+.|..\verb+|
|00000b30| 72 65 61 64 28 29 2b 20 | 72 65 61 64 73 20 61 20 |read()+ |reads a |
|00000b40| 6d 61 74 72 69 78 20 74 | 68 61 74 20 68 61 73 20 |matrix t|hat has |
|00000b50| 62 65 65 6e 20 77 72 69 | 74 74 65 6e 20 77 69 74 |been wri|tten wit|
|00000b60| 68 20 74 68 65 0d 5c 52 | 4c 61 42 5c 20 5c 76 65 |h the.\R|LaB\ \ve|
|00000b70| 72 62 2b 77 72 69 74 65 | 28 29 2b 20 66 75 6e 63 |rb+write|()+ func|
|00000b80| 74 69 6f 6e 20 20 28 53 | 65 65 20 53 65 63 74 69 |tion (S|ee Secti|
|00000b90| 6f 6e 7e 5c 72 65 66 7b | 66 6e 3a 72 65 61 64 7d |on~\ref{|fn:read}|
|00000ba0| 0d 61 6e 64 20 53 65 63 | 74 69 6f 6e 7e 5c 72 65 |.and Sec|tion~\re|
|00000bb0| 66 7b 66 6e 3a 77 72 69 | 74 65 7d 29 2e 20 48 65 |f{fn:wri|te}). He|
|00000bc0| 72 65 20 69 73 20 61 20 | 63 6f 6e 74 72 69 76 65 |re is a |contrive|
|00000bd0| 64 20 65 78 61 6d 70 6c | 65 20 2d 20 79 6f 75 20 |d exampl|e - you |
|00000be0| 77 6f 75 6c 64 0d 6e 6f | 72 6d 61 6c 6c 79 20 5c |would.no|rmally \|
|00000bf0| 76 65 72 62 2b 77 72 69 | 74 65 2b 20 69 74 20 6f |verb+wri|te+ it o|
|00000c00| 75 74 20 69 6e 20 6f 6e | 65 20 73 65 73 73 69 6f |ut in on|e sessio|
|00000c10| 6e 2c 20 61 6e 64 20 5c | 76 65 72 62 2b 72 65 61 |n, and \|verb+rea|
|00000c20| 64 2b 20 69 74 20 61 67 | 61 69 6e 0d 69 6e 20 61 |d+ it ag|ain.in a|
|00000c30| 20 6c 61 74 65 72 20 73 | 65 73 73 69 6f 6e 2e 20 | later s|ession. |
|00000c40| 59 6f 75 20 73 68 6f 75 | 6c 64 20 61 6c 73 6f 20 |You shou|ld also |
|00000c50| 72 65 61 6c 69 73 65 20 | 74 68 61 74 20 5c 76 65 |realise |that \ve|
|00000c60| 72 62 2b 72 65 61 64 2b | 20 61 6e 64 0d 5c 76 65 |rb+read+| and.\ve|
|00000c70| 72 62 2b 77 72 69 74 65 | 2b 20 61 72 65 20 6e 6f |rb+write|+ are no|
|00000c80| 74 20 72 65 73 74 72 69 | 63 74 65 64 20 74 6f 20 |t restri|cted to |
|00000c90| 61 20 73 74 6f 72 69 6e | 67 20 61 6e 64 20 72 65 |a storin|g and re|
|00000ca0| 74 72 69 65 76 69 6e 67 | 20 61 20 73 69 6e 67 6c |trieving| a singl|
|00000cb0| 65 0d 76 61 72 69 61 62 | 6c 65 2c 20 6f 72 20 65 |e.variab|le, or e|
|00000cc0| 76 65 6e 20 61 20 73 69 | 6e 67 6c 65 20 74 79 70 |ven a si|ngle typ|
|00000cd0| 65 20 6f 66 20 76 61 72 | 69 61 62 6c 65 2c 20 69 |e of var|iable, i|
|00000ce0| 6e 20 61 20 66 69 6c 65 | 2e 20 20 59 6f 75 20 63 |n a file|. You c|
|00000cf0| 61 6e 20 73 74 6f 72 65 | 0d 73 65 76 65 72 61 6c |an store|.several|
|00000d00| 20 64 69 66 66 65 72 65 | 6e 74 20 74 79 70 65 73 | differe|nt types|
|00000d10| 20 6f 66 20 76 61 72 69 | 61 62 6c 65 73 20 69 6e | of vari|ables in|
|00000d20| 20 65 61 63 68 20 66 69 | 6c 65 2c 20 61 63 63 6f | each fi|le, acco|
|00000d30| 72 64 69 6e 67 20 74 6f | 20 79 6f 75 72 0d 6e 65 |rding to| your.ne|
|00000d40| 65 64 73 2e 0d 0d 5c 62 | 65 67 69 6e 7b 76 65 72 |eds...\b|egin{ver|
|00000d50| 62 61 74 69 6d 7d 0d 3e | 20 7a 20 3d 20 5b 20 33 |batim}.>| z = [ 3|
|00000d60| 20 2c 20 34 3b 20 2d 34 | 2d 33 6a 20 2c 20 37 38 | , 4; -4|-3j , 78|
|00000d70| 36 20 5d 20 0d 20 7a 20 | 3d 0d 20 20 20 20 20 20 |6 ] . z |=. |
|00000d80| 20 20 20 20 20 20 20 20 | 20 20 20 20 33 20 2b 20 | | 3 + |
|00000d90| 30 69 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |0i | |
|00000da0| 20 20 20 20 34 20 2b 20 | 30 69 0d 20 20 20 20 20 | 4 + |0i. |
|00000db0| 20 20 20 20 20 20 20 20 | 20 20 20 20 2d 34 20 2d | | -4 -|
|00000dc0| 20 33 69 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | 3i | |
|00000dd0| 20 20 20 37 38 36 20 2b | 20 30 69 0d 3e 20 77 68 | 786 +| 0i.> wh|
|00000de0| 6f 28 29 0d 65 70 73 20 | 20 70 69 20 20 20 7a 20 |o().eps | pi z |
|00000df0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 0d 3e 20 | | .> |
|00000e00| 77 72 69 74 65 28 20 22 | 73 61 76 65 5f 7a 2e 64 |write( "|save_z.d|
|00000e10| 61 74 22 20 2c 20 7a 20 | 29 0d 20 20 20 20 20 20 |at" , z |). |
|00000e20| 20 20 31 0d 3e 20 2f 2f | 20 57 65 20 68 61 76 65 | 1.> //| We have|
|00000e30| 20 6e 6f 77 20 77 72 69 | 74 74 65 6e 20 6f 75 74 | now wri|tten out|
|00000e40| 20 74 68 65 20 6d 61 74 | 72 69 78 20 60 7a 27 20 | the mat|rix `z' |
|00000e50| 74 6f 20 74 68 65 20 66 | 69 6c 65 20 60 73 61 76 |to the f|ile `sav|
|00000e60| 65 5f 7a 2e 64 61 74 27 | 0d 3e 20 63 6c 65 61 72 |e_z.dat'|.> clear|
|00000e70| 28 7a 29 3b 0d 3e 20 77 | 68 6f 28 29 0d 65 70 73 |(z);.> w|ho().eps|
|00000e80| 20 20 70 69 20 20 20 20 | 20 20 20 20 20 20 20 20 | pi | |
|00000e90| 20 20 20 20 20 20 0d 3e | 20 2f 2f 20 54 68 65 20 | .>| // The |
|00000ea0| 6d 61 74 72 69 78 20 60 | 7a 27 20 69 73 20 6e 6f |matrix `|z' is no|
|00000eb0| 77 20 67 6f 6e 65 20 66 | 72 6f 6d 20 74 68 65 20 |w gone f|rom the |
|00000ec0| 73 79 6d 62 6f 6c 20 74 | 61 62 6c 65 0d 3e 20 72 |symbol t|able.> r|
|00000ed0| 65 61 64 28 20 22 73 61 | 76 65 5f 7a 2e 64 61 74 |ead( "sa|ve_z.dat|
|00000ee0| 22 20 29 0d 20 20 20 20 | 20 20 20 20 31 0d 3e 20 |" ). | 1.> |
|00000ef0| 77 68 6f 28 29 0d 65 70 | 73 20 20 70 69 20 20 20 |who().ep|s pi |
|00000f00| 7a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 0d |z | .|
|00000f10| 3e 20 2f 2f 20 41 6e 64 | 20 6e 6f 77 20 69 74 20 |> // And| now it |
|00000f20| 68 61 73 20 62 65 65 6e | 20 72 65 61 64 20 62 61 |has been| read ba|
|00000f30| 63 6b 20 69 6e 2e 0d 3e | 20 64 69 61 72 79 28 29 |ck in..>| diary()|
|00000f40| 0d 5c 65 6e 64 7b 76 65 | 72 62 61 74 69 6d 7d 0d |.\end{ve|rbatim}.|
|00000f50| 0d 5c 76 65 72 62 2b 72 | 65 61 64 6d 28 29 2b 20 |.\verb+r|eadm()+ |
|00000f60| 28 53 65 65 20 53 65 63 | 74 69 6f 6e 7e 5c 72 65 |(See Sec|tion~\re|
|00000f70| 66 7b 66 6e 3a 72 65 61 | 64 6d 7d 29 20 72 65 61 |f{fn:rea|dm}) rea|
|00000f80| 64 73 20 61 20 74 65 78 | 74 20 66 69 6c 65 0d 74 |ds a tex|t file.t|
|00000f90| 68 61 74 20 63 6f 6e 74 | 61 69 6e 73 20 77 68 69 |hat cont|ains whi|
|00000fa0| 74 65 2d 73 70 61 63 65 | 20 73 65 70 61 72 61 74 |te-space| separat|
|00000fb0| 65 64 20 63 6f 6c 75 6d | 6e 73 20 6f 66 20 6e 75 |ed colum|ns of nu|
|00000fc0| 6d 62 65 72 73 2e 20 20 | 54 68 69 73 20 69 73 0d |mbers. |This is.|
|00000fd0| 75 73 65 66 75 6c 20 69 | 66 20 79 6f 75 20 61 72 |useful i|f you ar|
|00000fe0| 65 20 74 72 79 69 6e 67 | 20 74 6f 20 75 73 65 20 |e trying| to use |
|00000ff0| 74 68 65 20 6f 75 74 70 | 75 74 20 6f 66 20 6f 74 |the outp|ut of ot|
|00001000| 68 65 72 20 70 72 6f 67 | 72 61 6d 73 2e 20 20 49 |her prog|rams. I|
|00001010| 66 20 79 6f 75 0d 77 61 | 6e 74 20 74 6f 2c 20 79 |f you.wa|nt to, y|
|00001020| 6f 75 20 63 61 6e 20 61 | 6c 73 6f 20 77 72 69 74 |ou can a|lso writ|
|00001030| 65 20 6f 75 74 20 61 20 | 6d 61 74 72 69 78 20 69 |e out a |matrix i|
|00001040| 6e 20 74 68 65 20 73 61 | 6d 65 20 66 6f 72 6d 61 |n the sa|me forma|
|00001050| 74 2c 20 75 73 69 6e 67 | 20 74 68 65 0d 5c 76 65 |t, using| the.\ve|
|00001060| 72 62 2b 77 72 69 74 65 | 6d 2b 20 66 75 6e 63 74 |rb+write|m+ funct|
|00001070| 69 6f 6e 2e 0d 49 66 20 | 79 6f 75 20 64 6f 6e 27 |ion..If |you don'|
|00001080| 74 20 6c 69 6b 65 20 74 | 68 65 20 77 61 79 20 74 |t like t|he way t|
|00001090| 68 65 20 6d 61 74 72 69 | 78 20 69 73 20 6f 72 67 |he matri|x is org|
|000010a0| 61 6e 69 73 65 64 2c 20 | 74 68 65 20 0d 5c 76 65 |anised, |the .\ve|
|000010b0| 72 62 2b 72 65 73 68 61 | 70 65 28 29 2b 20 66 75 |rb+resha|pe()+ fu|
|000010c0| 6e 63 74 69 6f 6e 20 28 | 53 65 65 20 53 65 63 74 |nction (|See Sect|
|000010d0| 69 6f 6e 7e 5c 72 65 66 | 7b 66 6e 3a 72 65 73 68 |ion~\ref|{fn:resh|
|000010e0| 61 70 65 7d 29 0d 69 73 | 20 61 20 67 6f 6f 64 20 |ape}).is| a good |
|000010f0| 77 61 79 20 74 6f 20 72 | 65 73 74 72 75 63 74 75 |way to r|estructu|
|00001100| 72 65 20 69 74 2e 20 0d | 0d 5c 62 65 67 69 6e 7b |re it. .|.\begin{|
|00001110| 76 65 72 62 61 74 69 6d | 7d 0d 3e 20 61 20 3d 20 |verbatim|}.> a = |
|00001120| 5b 20 31 2c 20 32 2c 20 | 33 2c 20 34 3b 20 35 2c |[ 1, 2, |3, 4; 5,|
|00001130| 20 36 2c 20 37 2c 20 38 | 3b 20 39 2c 20 31 30 2c | 6, 7, 8|; 9, 10,|
|00001140| 20 31 31 2c 20 31 32 5d | 0d 20 61 20 3d 0d 20 20 | 11, 12]|. a =. |
|00001150| 20 20 20 20 20 20 31 20 | 20 20 20 20 20 20 20 20 | 1 | |
|00001160| 20 32 20 20 20 20 20 20 | 20 20 20 20 33 20 20 20 | 2 | 3 |
|00001170| 20 20 20 20 20 20 20 34 | 20 20 0d 20 20 20 20 20 | 4| . |
|00001180| 20 20 20 35 20 20 20 20 | 20 20 20 20 20 20 36 20 | 5 | 6 |
|00001190| 20 20 20 20 20 20 20 20 | 20 37 20 20 20 20 20 20 | | 7 |
|000011a0| 20 20 20 20 38 20 20 0d | 20 20 20 20 20 20 20 20 | 8 .| |
|000011b0| 39 20 20 20 20 20 20 20 | 20 20 31 30 20 20 20 20 |9 | 10 |
|000011c0| 20 20 20 20 20 31 31 20 | 20 20 20 20 20 20 20 20 | 11 | |
|000011d0| 31 32 20 20 0d 3e 20 2f | 2f 20 4e 6f 77 20 77 65 |12 .> /|/ Now we|
|000011e0| 20 77 72 69 74 65 20 74 | 68 65 20 6d 61 74 72 69 | write t|he matri|
|000011f0| 78 20 74 6f 20 61 20 66 | 69 6c 65 2e 0d 3e 20 77 |x to a f|ile..> w|
|00001200| 72 69 74 65 6d 28 22 6d | 61 74 72 69 78 5f 74 65 |ritem("m|atrix_te|
|00001210| 78 74 22 2c 20 61 29 0d | 20 20 20 20 20 20 20 20 |xt", a).| |
|00001220| 31 0d 3e 20 63 6c 65 61 | 72 28 61 29 0d 20 20 20 |1.> clea|r(a). |
|00001230| 20 20 20 20 20 31 0d 3e | 20 77 68 6f 28 29 0d 65 | 1.>| who().e|
|00001240| 70 73 20 20 70 69 20 20 | 20 20 20 20 20 20 20 20 |ps pi | |
|00001250| 20 20 20 20 20 20 20 20 | 0d 3e 20 2f 2f 20 41 6e | |.> // An|
|00001260| 64 20 67 65 74 20 69 74 | 20 62 61 63 6b 20 2d 20 |d get it| back - |
|00001270| 73 74 6f 72 65 20 69 74 | 20 69 6e 20 61 20 64 69 |store it| in a di|
|00001280| 66 66 65 72 65 6e 74 20 | 76 61 72 69 61 62 6c 65 |fferent |variable|
|00001290| 20 74 68 69 73 20 74 69 | 6d 65 0d 3e 20 62 20 3d | this ti|me.> b =|
|000012a0| 20 72 65 61 64 6d 28 22 | 6d 61 74 72 69 78 5f 74 | readm("|matrix_t|
|000012b0| 65 78 74 22 29 0d 20 62 | 20 3d 0d 20 20 20 20 20 |ext"). b| =. |
|000012c0| 20 20 20 31 20 20 20 20 | 20 20 20 20 20 20 32 20 | 1 | 2 |
|000012d0| 20 20 20 20 20 20 20 20 | 20 33 20 20 20 20 20 20 | | 3 |
|000012e0| 20 20 20 20 34 20 20 0d | 20 20 20 20 20 20 20 20 | 4 .| |
|000012f0| 35 20 20 20 20 20 20 20 | 20 20 20 36 20 20 20 20 |5 | 6 |
|00001300| 20 20 20 20 20 20 37 20 | 20 20 20 20 20 20 20 20 | 7 | |
|00001310| 20 38 20 20 0d 20 20 20 | 20 20 20 20 20 39 20 20 | 8 . | 9 |
|00001320| 20 20 20 20 20 20 20 31 | 30 20 20 20 20 20 20 20 | 1|0 |
|00001330| 20 20 31 31 20 20 20 20 | 20 20 20 20 20 31 32 20 | 11 | 12 |
|00001340| 20 0d 3e 20 2f 2f 20 42 | 75 74 20 77 65 20 77 61 | .> // B|ut we wa|
|00001350| 6e 74 20 74 68 6f 73 65 | 20 65 6c 65 6d 65 6e 74 |nt those| element|
|00001360| 73 20 6f 72 67 61 6e 69 | 73 65 64 20 61 73 20 74 |s organi|sed as t|
|00001370| 77 6f 20 72 6f 77 73 20 | 61 6e 64 20 73 69 78 20 |wo rows |and six |
|00001380| 63 6f 6c 75 6d 6e 73 0d | 3e 20 63 20 3d 20 72 65 |columns.|> c = re|
|00001390| 73 68 61 70 65 28 62 2c | 20 32 2c 36 29 0d 20 63 |shape(b,| 2,6). c|
|000013a0| 20 3d 0d 20 6d 61 74 72 | 69 78 20 63 6f 6c 75 6d | =. matr|ix colum|
|000013b0| 6e 73 20 31 20 74 68 72 | 75 20 36 0d 20 20 20 20 |ns 1 thr|u 6. |
|000013c0| 20 20 20 20 31 20 20 20 | 20 20 20 20 20 20 20 39 | 1 | 9|
|000013d0| 20 20 20 20 20 20 20 20 | 20 20 36 20 20 20 20 20 | | 6 |
|000013e0| 20 20 20 20 20 33 20 20 | 20 20 20 20 20 20 20 31 | 3 | 1|
|000013f0| 31 20 20 20 20 20 20 20 | 20 20 20 38 20 20 0d 20 |1 | 8 . |
|00001400| 20 20 20 20 20 20 20 35 | 20 20 20 20 20 20 20 20 | 5| |
|00001410| 20 20 32 20 20 20 20 20 | 20 20 20 20 31 30 20 20 | 2 | 10 |
|00001420| 20 20 20 20 20 20 20 20 | 37 20 20 20 20 20 20 20 | |7 |
|00001430| 20 20 20 34 20 20 20 20 | 20 20 20 20 20 31 32 20 | 4 | 12 |
|00001440| 20 0d 5c 65 6e 64 7b 76 | 65 72 62 61 74 69 6d 7d | .\end{v|erbatim}|
|00001450| 0d 0d 49 74 20 61 70 70 | 65 61 72 73 20 74 68 61 |..It app|ears tha|
|00001460| 74 20 74 68 69 6e 67 73 | 20 68 61 76 65 20 67 6f |t things| have go|
|00001470| 6e 65 20 68 6f 72 72 69 | 62 6c 79 20 77 72 6f 6e |ne horri|bly wron|
|00001480| 67 20 69 6e 20 74 68 61 | 74 20 6c 61 73 74 20 65 |g in tha|t last e|
|00001490| 78 61 6d 70 6c 65 2e 0d | 48 6f 77 65 76 65 72 20 |xample..|However |
|000014a0| 74 68 69 73 20 69 73 20 | 65 78 70 65 63 74 65 64 |this is |expected|
|000014b0| 20 62 65 68 61 76 69 6f | 72 2e 20 54 68 65 20 6d | behavio|r. The m|
|000014c0| 61 74 72 69 78 20 69 73 | 20 73 74 6f 72 65 64 20 |atrix is| stored |
|000014d0| 63 6f 6c 75 6d 6e 20 62 | 79 0d 63 6f 6c 75 6d 6e |column b|y.column|
|000014e0| 2c 20 61 6e 64 20 69 66 | 20 79 6f 75 20 72 75 6e |, and if| you run|
|000014f0| 20 64 6f 77 6e 20 65 61 | 63 68 20 63 6f 6c 75 6d | down ea|ch colum|
|00001500| 6e 20 69 6e 20 65 61 63 | 68 20 6d 61 74 72 69 78 |n in eac|h matrix|
|00001510| 2c 20 74 68 65 20 6f 72 | 64 65 72 20 69 73 0d 74 |, the or|der is.t|
|00001520| 68 65 20 73 61 6d 65 20 | 69 6e 20 65 61 63 68 20 |he same |in each |
|00001530| 6d 61 74 72 69 78 2e 20 | 20 54 68 65 20 74 72 61 |matrix. | The tra|
|00001540| 6e 73 70 6f 73 69 74 69 | 6f 6e 20 6f 70 65 72 61 |nspositi|on opera|
|00001550| 74 6f 72 20 6d 69 67 68 | 74 20 63 6f 6d 65 20 69 |tor migh|t come i|
|00001560| 6e 0d 68 61 6e 64 79 20 | 69 66 20 79 6f 75 20 77 |n.handy |if you w|
|00001570| 61 6e 74 20 69 74 20 74 | 6f 20 77 6f 72 6b 20 62 |ant it t|o work b|
|00001580| 79 20 72 6f 77 73 2c 20 | 61 73 20 73 68 6f 77 6e |y rows, |as shown|
|00001590| 20 68 65 72 65 3a 0d 5c | 62 65 67 69 6e 7b 76 65 | here:.\|begin{ve|
|000015a0| 72 62 61 74 69 6d 7d 0d | 3e 20 64 20 3d 20 72 65 |rbatim}.|> d = re|
|000015b0| 73 68 61 70 65 28 62 27 | 2c 20 32 2c 36 29 0d 20 |shape(b'|, 2,6). |
|000015c0| 64 20 3d 0d 20 6d 61 74 | 72 69 78 20 63 6f 6c 75 |d =. mat|rix colu|
|000015d0| 6d 6e 73 20 31 20 74 68 | 72 75 20 36 0d 20 20 20 |mns 1 th|ru 6. |
|000015e0| 20 20 20 20 20 31 20 20 | 20 20 20 20 20 20 20 20 | 1 | |
|000015f0| 33 20 20 20 20 20 20 20 | 20 20 20 35 20 20 20 20 |3 | 5 |
|00001600| 20 20 20 20 20 20 37 20 | 20 20 20 20 20 20 20 20 | 7 | |
|00001610| 20 39 20 20 20 20 20 20 | 20 20 20 31 31 20 20 0d | 9 | 11 .|
|00001620| 20 20 20 20 20 20 20 20 | 32 20 20 20 20 20 20 20 | |2 |
|00001630| 20 20 20 34 20 20 20 20 | 20 20 20 20 20 20 36 20 | 4 | 6 |
|00001640| 20 20 20 20 20 20 20 20 | 20 38 20 20 20 20 20 20 | | 8 |
|00001650| 20 20 20 31 30 20 20 20 | 20 20 20 20 20 20 31 32 | 10 | 12|
|00001660| 20 20 0d 3e 20 65 20 3d | 20 28 72 65 73 68 61 70 | .> e =| (reshap|
|00001670| 65 28 62 27 2c 36 2c 32 | 29 29 27 0d 20 65 20 3d |e(b',6,2|))'. e =|
|00001680| 0d 20 6d 61 74 72 69 78 | 20 63 6f 6c 75 6d 6e 73 |. matrix| columns|
|00001690| 20 31 20 74 68 72 75 20 | 36 0d 20 20 20 20 20 20 | 1 thru |6. |
|000016a0| 20 20 31 20 20 20 20 20 | 20 20 20 20 20 32 20 20 | 1 | 2 |
|000016b0| 20 20 20 20 20 20 20 20 | 33 20 20 20 20 20 20 20 | |3 |
|000016c0| 20 20 20 34 20 20 20 20 | 20 20 20 20 20 20 35 20 | 4 | 5 |
|000016d0| 20 20 20 20 20 20 20 20 | 20 36 20 20 0d 20 20 20 | | 6 . |
|000016e0| 20 20 20 20 20 37 20 20 | 20 20 20 20 20 20 20 20 | 7 | |
|000016f0| 38 20 20 20 20 20 20 20 | 20 20 20 39 20 20 20 20 |8 | 9 |
|00001700| 20 20 20 20 20 31 30 20 | 20 20 20 20 20 20 20 20 | 10 | |
|00001710| 31 31 20 20 20 20 20 20 | 20 20 20 31 32 20 20 0d |11 | 12 .|
|00001720| 5c 65 6e 64 7b 76 65 72 | 62 61 74 69 6d 7d 0d 0d |\end{ver|batim}..|
|00001730| 0d 53 6f 6d 65 74 69 6d | 65 73 20 77 68 65 6e 20 |.Sometim|es when |
|00001740| 79 6f 75 20 68 61 76 65 | 20 61 20 70 72 6f 62 6c |you have| a probl|
|00001750| 65 6d 20 74 68 61 74 20 | 69 73 20 72 65 70 72 65 |em that |is repre|
|00001760| 73 65 6e 74 65 64 20 61 | 73 20 74 77 6f 20 6d 61 |sented a|s two ma|
|00001770| 74 72 69 63 65 73 2c 0d | 79 6f 75 20 77 6f 75 6c |trices,.|you woul|
|00001780| 64 20 6c 69 6b 65 20 74 | 6f 20 63 6f 6d 62 69 6e |d like t|o combin|
|00001790| 65 20 74 68 65 6d 20 74 | 6f 20 6d 61 6b 65 20 61 |e them t|o make a|
|000017a0| 20 73 69 6e 67 6c 65 20 | 6d 61 74 72 69 78 2e 20 | single |matrix. |
|000017b0| 20 54 68 69 73 20 69 73 | 20 61 0d 70 72 65 74 74 | This is| a.prett|
|000017c0| 79 20 73 69 6d 70 6c 65 | 20 74 61 73 6b 20 61 73 |y simple| task as|
|000017d0| 20 73 6f 6f 6e 20 61 73 | 20 79 6f 75 20 72 65 61 | soon as| you rea|
|000017e0| 6c 69 73 65 20 74 68 61 | 74 20 74 68 65 72 65 20 |lise tha|t there |
|000017f0| 69 73 20 6e 6f 74 68 69 | 6e 67 20 74 68 61 74 0d |is nothi|ng that.|
|00001800| 6d 61 6b 65 73 20 74 68 | 65 20 74 68 69 6e 67 73 |makes th|e things|
|00001810| 20 69 6e 73 69 64 65 20 | 74 68 65 20 73 71 75 61 | inside |the squa|
|00001820| 72 65 20 62 72 61 63 6b | 65 74 73 20 68 61 76 65 |re brack|ets have|
|00001830| 20 74 6f 20 62 65 20 73 | 63 61 6c 61 72 73 20 2d | to be s|calars -|
|00001840| 2d 2d 0d 74 68 65 79 20 | 63 61 6e 20 61 6c 73 6f |--.they |can also|
|00001850| 20 62 65 20 73 74 72 69 | 6e 67 73 20 61 6e 64 20 | be stri|ngs and |
|00001860| 6f 74 68 65 72 20 6d 61 | 74 72 69 63 69 65 73 2e |other ma|tricies.|
|00001870| 20 20 57 65 20 77 69 6c | 6c 20 6c 6f 6f 6b 20 61 | We wil|l look a|
|00001880| 74 20 75 73 69 6e 67 0d | 6d 61 74 72 69 63 69 65 |t using.|matricie|
|00001890| 73 20 68 65 72 65 2c 20 | 61 6e 64 20 64 65 61 6c |s here, |and deal|
|000018a0| 20 77 69 74 68 20 73 74 | 72 69 6e 67 73 20 6c 61 | with st|rings la|
|000018b0| 74 65 72 2e 0d 0d 57 68 | 65 6e 20 74 72 79 69 6e |ter...Wh|en tryin|
|000018c0| 67 20 74 6f 20 74 61 63 | 6b 20 73 65 76 65 72 61 |g to tac|k severa|
|000018d0| 6c 20 6d 61 74 72 69 63 | 69 65 73 20 74 6f 67 65 |l matric|ies toge|
|000018e0| 74 68 65 72 20 74 6f 20 | 6d 61 6b 65 20 61 20 6e |ther to |make a n|
|000018f0| 65 77 20 6d 61 74 72 69 | 78 2c 0d 6f 72 20 75 73 |ew matri|x,.or us|
|00001900| 69 6e 67 20 61 20 63 6f | 6d 62 69 6e 61 74 69 6f |ing a co|mbinatio|
|00001910| 6e 20 6f 66 20 73 63 61 | 6c 61 72 73 20 61 6e 64 |n of sca|lars and|
|00001920| 20 6d 61 74 72 69 63 69 | 65 73 20 74 6f 20 6d 61 | matrici|es to ma|
|00001930| 6b 65 20 61 20 6e 65 77 | 20 6d 61 74 72 69 78 2c |ke a new| matrix,|
|00001940| 0d 79 6f 75 20 73 68 6f | 75 6c 64 20 74 68 69 6e |.you sho|uld thin|
|00001950| 6b 20 6f 66 20 74 68 65 | 20 6d 61 74 72 69 63 69 |k of the| matrici|
|00001960| 65 73 20 61 73 20 62 65 | 69 6e 67 20 65 71 75 69 |es as be|ing equi|
|00001970| 76 61 6c 65 6e 74 20 74 | 6f 20 68 6f 77 20 74 68 |valent t|o how th|
|00001980| 65 79 0d 77 6f 75 6c 64 | 20 62 65 20 72 65 70 72 |ey.would| be repr|
|00001990| 65 73 65 6e 74 65 64 20 | 69 66 20 79 6f 75 20 68 |esented |if you h|
|000019a0| 61 64 20 74 6f 20 74 79 | 70 65 20 74 68 65 6d 20 |ad to ty|pe them |
|000019b0| 79 6f 75 72 73 65 6c 66 | 2e 20 20 53 6f 20 69 6d |yourself|. So im|
|000019c0| 61 67 69 6e 65 0d 74 68 | 61 74 20 65 61 63 68 20 |agine.th|at each |
|000019d0| 72 6f 77 20 69 73 20 74 | 65 72 6d 69 6e 61 74 65 |row is t|erminate|
|000019e0| 64 20 77 69 74 68 20 61 | 20 73 65 6d 69 63 6f 6c |d with a| semicol|
|000019f0| 6f 6e 20 61 6e 64 20 65 | 61 63 68 20 65 6c 65 6d |on and e|ach elem|
|00001a00| 65 6e 74 0d 73 65 70 65 | 72 61 74 65 64 20 62 79 |ent.sepe|rated by|
|00001a10| 20 61 20 63 6f 6d 6d 61 | 2e 20 20 54 68 65 6e 20 | a comma|. Then |
|00001a20| 66 69 6c 6c 20 69 6e 20 | 63 6f 6d 6d 61 73 20 61 |fill in |commas a|
|00001a30| 6e 64 20 73 65 6d 69 63 | 6f 6c 6f 6e 73 20 62 65 |nd semic|olons be|
|00001a40| 74 77 65 65 6e 20 74 68 | 65 0d 65 6c 65 6d 65 6e |tween th|e.elemen|
|00001a50| 74 73 20 74 6f 20 6d 61 | 6b 65 20 75 70 20 74 68 |ts to ma|ke up th|
|00001a60| 65 20 6e 65 77 20 6d 61 | 74 72 69 78 2e 20 20 48 |e new ma|trix. H|
|00001a70| 65 72 65 20 61 72 65 20 | 73 6f 6d 65 20 65 78 61 |ere are |some exa|
|00001a80| 6d 70 6c 65 73 3a 0d 0d | 5c 62 65 67 69 6e 7b 76 |mples:..|\begin{v|
|00001a90| 65 72 62 61 74 69 6d 7d | 0d 3e 20 61 20 3d 20 5b |erbatim}|.> a = [|
|00001aa0| 31 2c 20 32 2c 33 3b 20 | 34 2c 35 2c 36 5d 0d 20 |1, 2,3; |4,5,6]. |
|00001ab0| 61 20 3d 0d 20 20 20 20 | 20 20 20 20 31 20 20 20 |a =. | 1 |
|00001ac0| 20 20 20 20 20 20 20 32 | 20 20 20 20 20 20 20 20 | 2| |
|00001ad0| 20 20 33 20 20 0d 20 20 | 20 20 20 20 20 20 34 20 | 3 . | 4 |
|00001ae0| 20 20 20 20 20 20 20 20 | 20 35 20 20 20 20 20 20 | | 5 |
|00001af0| 20 20 20 20 36 20 20 0d | 3e 20 62 20 3d 20 5b 20 | 6 .|> b = [ |
|00001b00| 37 2c 20 38 2c 20 39 3b | 20 31 30 2c 20 31 31 2c |7, 8, 9;| 10, 11,|
|00001b10| 20 31 32 5d 0d 20 62 20 | 3d 0d 20 20 20 20 20 20 | 12]. b |=. |
|00001b20| 20 20 37 20 20 20 20 20 | 20 20 20 20 20 38 20 20 | 7 | 8 |
|00001b30| 20 20 20 20 20 20 20 20 | 39 20 20 0d 20 20 20 20 | |9 . |
|00001b40| 20 20 20 31 30 20 20 20 | 20 20 20 20 20 20 31 31 | 10 | 11|
|00001b50| 20 20 20 20 20 20 20 20 | 20 31 32 20 20 0d 3e 20 | | 12 .> |
|00001b60| 63 20 3d 20 5b 61 2c 62 | 5d 0d 20 63 20 3d 0d 20 |c = [a,b|]. c =. |
|00001b70| 6d 61 74 72 69 78 20 63 | 6f 6c 75 6d 6e 73 20 31 |matrix c|olumns 1|
|00001b80| 20 74 68 72 75 20 36 0d | 20 20 20 20 20 20 20 20 | thru 6.| |
|00001b90| 31 20 20 20 20 20 20 20 | 20 20 20 32 20 20 20 20 |1 | 2 |
|00001ba0| 20 20 20 20 20 20 33 20 | 20 20 20 20 20 20 20 20 | 3 | |
|00001bb0| 20 37 20 20 20 20 20 20 | 20 20 20 20 38 20 20 20 | 7 | 8 |
|00001bc0| 20 20 20 20 20 20 20 39 | 20 20 0d 20 20 20 20 20 | 9| . |
|00001bd0| 20 20 20 34 20 20 20 20 | 20 20 20 20 20 20 35 20 | 4 | 5 |
|00001be0| 20 20 20 20 20 20 20 20 | 20 36 20 20 20 20 20 20 | | 6 |
|00001bf0| 20 20 20 31 30 20 20 20 | 20 20 20 20 20 20 31 31 | 10 | 11|
|00001c00| 20 20 20 20 20 20 20 20 | 20 31 32 20 20 0d 3e 20 | | 12 .> |
|00001c10| 64 20 3d 20 5b 61 3b 62 | 5d 0d 20 64 20 3d 0d 20 |d = [a;b|]. d =. |
|00001c20| 20 20 20 20 20 20 20 31 | 20 20 20 20 20 20 20 20 | 1| |
|00001c30| 20 20 32 20 20 20 20 20 | 20 20 20 20 20 33 20 20 | 2 | 3 |
|00001c40| 0d 20 20 20 20 20 20 20 | 20 34 20 20 20 20 20 20 |. | 4 |
|00001c50| 20 20 20 20 35 20 20 20 | 20 20 20 20 20 20 20 36 | 5 | 6|
|00001c60| 20 20 0d 20 20 20 20 20 | 20 20 20 37 20 20 20 20 | . | 7 |
|00001c70| 20 20 20 20 20 20 38 20 | 20 20 20 20 20 20 20 20 | 8 | |
|00001c80| 20 39 20 20 0d 20 20 20 | 20 20 20 20 31 30 20 20 | 9 . | 10 |
|00001c90| 20 20 20 20 20 20 20 31 | 31 20 20 20 20 20 20 20 | 1|1 |
|00001ca0| 20 20 31 32 20 20 0d 3e | 20 65 20 3d 20 5b 20 2d | 12 .>| e = [ -|
|00001cb0| 32 2c 20 2d 31 20 2c 30 | 3b 20 61 5d 0d 20 65 20 |2, -1 ,0|; a]. e |
|00001cc0| 3d 0d 20 20 20 20 20 20 | 20 2d 32 20 20 20 20 20 |=. | -2 |
|00001cd0| 20 20 20 20 2d 31 20 20 | 20 20 20 20 20 20 20 20 | -1 | |
|00001ce0| 30 20 20 0d 20 20 20 20 | 20 20 20 20 31 20 20 20 |0 . | 1 |
|00001cf0| 20 20 20 20 20 20 20 32 | 20 20 20 20 20 20 20 20 | 2| |
|00001d00| 20 20 33 20 20 0d 20 20 | 20 20 20 20 20 20 34 20 | 3 . | 4 |
|00001d10| 20 20 20 20 20 20 20 20 | 20 35 20 20 20 20 20 20 | | 5 |
|00001d20| 20 20 20 20 36 20 20 0d | 5c 65 6e 64 7b 76 65 72 | 6 .|\end{ver|
|00001d30| 62 61 74 69 6d 7d 0d 0d | 5c 73 65 63 74 69 6f 6e |batim}..|\section|
|00001d40| 7b 56 65 63 74 6f 72 20 | 43 72 65 61 74 69 6f 6e |{Vector |Creation|
|00001d50| 7d 0d 5c 69 6e 64 65 78 | 7b 76 65 63 74 6f 72 73 |}.\index|{vectors|
|00001d60| 7d 0d 41 6c 74 68 6f 75 | 67 68 20 74 68 65 72 65 |}.Althou|gh there|
|00001d70| 20 69 73 20 6e 6f 20 64 | 69 73 74 69 6e 63 74 20 | is no d|istinct |
|00001d80| 76 65 63 74 6f 72 20 74 | 79 70 65 20 69 6e 20 5c |vector t|ype in \|
|00001d90| 52 4c 61 42 20 2c 20 79 | 6f 75 20 63 61 6e 0d 70 |RLaB , y|ou can.p|
|00001da0| 72 65 74 65 6e 64 20 74 | 68 61 74 20 74 68 65 72 |retend t|hat ther|
|00001db0| 65 20 69 73 2e 20 49 66 | 20 79 6f 75 72 20 61 6c |e is. If| your al|
|00001dc0| 67 6f 72 69 74 68 6d 20 | 6f 72 20 70 72 6f 67 72 |gorithm |or progr|
|00001dd0| 61 6d 20 64 6f 65 73 20 | 6e 6f 74 20 6e 65 65 64 |am does |not need|
|00001de0| 0d 74 77 6f 20 64 69 6d | 65 6e 73 69 6f 6e 61 6c |.two dim|ensional|
|00001df0| 20 61 72 72 61 79 73 2c | 20 74 68 65 6e 20 79 6f | arrays,| then yo|
|00001e00| 75 20 63 61 6e 20 75 73 | 65 20 6d 61 74 72 69 63 |u can us|e matric|
|00001e10| 65 73 20 61 73 20 6f 6e | 65 20 64 69 6d 65 6e 73 |es as on|e dimens|
|00001e20| 69 6f 6e 65 64 0d 61 72 | 72 61 79 73 2e 0d 0d 57 |ioned.ar|rays...W|
|00001e30| 68 65 6e 20 75 73 69 6e | 67 20 76 65 63 74 6f 72 |hen usin|g vector|
|00001e40| 73 2c 20 6f 72 20 73 69 | 6e 67 6c 65 20 64 69 6d |s, or si|ngle dim|
|00001e50| 65 6e 73 69 6f 6e 20 61 | 72 72 61 79 73 2c 20 72 |ension a|rrays, r|
|00001e60| 6f 77 20 6d 61 74 72 69 | 63 65 73 20 61 72 65 0d |ow matri|ces are.|
|00001e70| 63 72 65 61 74 65 64 2e | 20 54 68 65 20 73 69 6d |created.| The sim|
|00001e80| 70 6c 65 73 74 20 77 61 | 79 20 74 6f 20 63 72 65 |plest wa|y to cre|
|00001e90| 61 74 65 20 61 20 76 65 | 63 74 6f 72 20 69 73 20 |ate a ve|ctor is |
|00001ea0| 77 69 74 68 20 74 68 65 | 20 60 5c 76 65 72 62 2b |with the| `\verb+|
|00001eb0| 3a 2b 27 0d 6f 70 65 72 | 61 74 6f 72 28 73 29 3a |:+'.oper|ator(s):|
|00001ec0| 20 0d 5c 62 65 67 69 6e | 7b 72 61 69 6c 7d 0d 56 | .\begin|{rail}.V|
|00001ed0| 65 63 74 6f 72 3a 20 73 | 74 61 72 74 20 27 3a 27 |ector: s|tart ':'|
|00001ee0| 20 65 6e 64 20 28 20 27 | 3a 27 20 69 6e 63 72 65 | end ( '|:' incre|
|00001ef0| 6d 65 6e 74 20 29 20 3f | 3b 0d 5c 65 6e 64 7b 72 |ment ) ?|;.\end{r|
|00001f00| 61 69 6c 7d 0d 0d 54 68 | 65 20 66 69 72 73 74 20 |ail}..Th|e first |
|00001f10| 6f 70 65 72 61 6e 64 20 | 73 70 65 63 69 66 69 65 |operand |specifie|
|00001f20| 73 20 74 68 65 20 73 74 | 61 72 74 69 6e 67 20 76 |s the st|arting v|
|00001f30| 61 6c 75 65 2c 20 74 68 | 65 20 73 65 63 6f 6e 64 |alue, th|e second|
|00001f40| 20 6f 70 65 72 61 6e 64 | 0d 73 70 65 63 69 66 69 | operand|.specifi|
|00001f50| 65 73 20 74 68 65 20 6c | 61 73 74 20 76 61 6c 75 |es the l|ast valu|
|00001f60| 65 2e 20 54 68 65 20 6f | 70 74 69 6f 6e 61 6c 20 |e. The o|ptional |
|00001f70| 74 68 69 72 64 20 6f 70 | 65 72 61 6e 64 20 63 61 |third op|erand ca|
|00001f80| 6e 20 62 65 20 75 73 65 | 64 20 74 6f 0d 73 70 65 |n be use|d to.spe|
|00001f90| 63 69 66 79 20 61 6e 20 | 69 6e 63 72 65 6d 65 6e |cify an |incremen|
|00001fa0| 74 2e 20 49 66 20 74 68 | 69 73 20 69 73 20 6e 6f |t. If th|is is no|
|00001fb0| 74 20 73 70 65 63 69 66 | 69 65 64 2c 20 74 68 65 |t specif|ied, the|
|00001fc0| 20 64 65 66 61 75 6c 74 | 0d 69 6e 63 72 65 6d 65 | default|.increme|
|00001fd0| 6e 74 20 69 73 20 31 2e | 20 48 65 72 65 20 61 72 |nt is 1.| Here ar|
|00001fe0| 65 20 73 6f 6d 65 20 65 | 78 61 6d 70 6c 65 73 3a |e some e|xamples:|
|00001ff0| 0d 0d 5c 62 65 67 69 6e | 7b 76 65 72 62 61 74 69 |..\begin|{verbati|
|00002000| 6d 7d 0d 3e 20 63 20 3d | 20 31 3a 34 0d 20 63 20 |m}.> c =| 1:4. c |
|00002010| 3d 0d 20 20 20 20 20 20 | 20 20 31 20 20 20 20 20 |=. | 1 |
|00002020| 20 20 20 20 20 32 20 20 | 20 20 20 20 20 20 20 20 | 2 | |
|00002030| 33 20 20 20 20 20 20 20 | 20 20 20 34 20 20 0d 3e |3 | 4 .>|
|00002040| 20 64 20 3d 20 31 3a 33 | 3a 30 2e 35 0d 20 64 20 | d = 1:3|:0.5. d |
|00002050| 3d 0d 20 20 20 20 20 20 | 20 20 31 20 20 20 20 20 |=. | 1 |
|00002060| 20 20 20 31 2e 35 20 20 | 20 20 20 20 20 20 20 20 | 1.5 | |
|00002070| 32 20 20 20 20 20 20 20 | 20 32 2e 35 20 20 20 20 |2 | 2.5 |
|00002080| 20 20 20 20 20 20 33 20 | 20 0d 3e 20 65 20 3d 20 | 3 | .> e = |
|00002090| 31 3a 33 3a 30 2e 36 0d | 20 65 20 3d 0d 20 20 20 |1:3:0.6.| e =. |
|000020a0| 20 20 20 20 20 31 20 20 | 20 20 20 20 20 20 31 2e | 1 | 1.|
|000020b0| 36 20 20 20 20 20 20 20 | 20 32 2e 32 20 20 20 20 |6 | 2.2 |
|000020c0| 20 20 20 20 32 2e 38 20 | 20 0d 5c 65 6e 64 7b 76 | 2.8 | .\end{v|
|000020d0| 65 72 62 61 74 69 6d 7d | 0d 0d 54 68 65 20 6f 74 |erbatim}|..The ot|
|000020e0| 68 65 72 20 77 61 79 20 | 74 6f 20 67 65 6e 65 72 |her way |to gener|
|000020f0| 61 74 65 20 61 20 76 65 | 63 74 6f 72 20 69 73 20 |ate a ve|ctor is |
|00002100| 74 6f 20 73 69 6d 70 6c | 79 20 73 70 65 63 69 66 |to simpl|y specif|
|00002110| 79 20 69 74 20 75 73 69 | 6e 67 20 74 68 65 0d 6d |y it usi|ng the.m|
|00002120| 61 74 72 69 78 20 66 6f | 72 6d 20 77 69 74 68 20 |atrix fo|rm with |
|00002130| 6f 6e 65 20 6f 66 20 74 | 68 65 20 64 69 6d 65 6e |one of t|he dimen|
|00002140| 73 69 6f 6e 73 20 73 65 | 74 20 74 6f 20 24 31 24 |sions se|t to $1$|
|00002150| 2e 20 20 54 68 69 73 20 | 6d 65 74 68 6f 64 20 61 |. This |method a|
|00002160| 6c 6c 6f 77 73 0d 79 6f | 75 20 74 6f 20 67 65 6e |llows.yo|u to gen|
|00002170| 65 72 61 74 65 20 61 20 | 76 65 63 74 6f 72 20 63 |erate a |vector c|
|00002180| 6f 6e 74 61 69 6e 69 6e | 67 20 61 6e 79 20 65 6c |ontainin|g any el|
|00002190| 65 6d 65 6e 74 73 2c 20 | 6e 6f 74 20 6a 75 73 74 |ements, |not just|
|000021a0| 20 61 6e 20 65 76 65 6e | 6c 79 0d 73 70 61 63 65 | an even|ly.space|
|000021b0| 64 20 73 65 71 75 65 6e | 63 65 2e 20 20 4a 75 73 |d sequen|ce. Jus|
|000021c0| 74 20 72 65 6d 65 6d 62 | 65 72 20 74 68 61 74 20 |t rememb|er that |
|000021d0| 5c 52 4c 61 42 5c 20 64 | 6f 65 73 6e 27 74 20 6b |\RLaB\ d|oesn't k|
|000021e0| 6e 6f 77 20 61 6e 79 74 | 68 69 6e 67 0d 61 62 6f |now anyt|hing.abo|
|000021f0| 75 74 20 76 65 63 74 6f | 72 73 20 2d 2d 2d 20 74 |ut vecto|rs --- t|
|00002200| 68 65 79 20 61 72 65 20 | 6a 75 73 74 20 61 20 6d |hey are |just a m|
|00002210| 61 74 72 69 78 20 77 68 | 65 72 65 20 6f 6e 65 20 |atrix wh|ere one |
|00002220| 6f 66 20 74 68 65 20 64 | 69 6d 65 6e 73 69 6f 6e |of the d|imension|
|00002230| 73 0d 69 73 20 24 31 24 | 2e 20 20 53 6f 6d 65 20 |s.is $1$|. Some |
|00002240| 66 75 6e 63 74 69 6f 6e | 73 20 64 6f 20 73 6f 6d |function|s do som|
|00002250| 65 74 68 69 6e 67 20 73 | 6c 69 67 68 74 6c 79 20 |ething s|lightly |
|00002260| 64 69 66 66 65 72 65 6e | 74 20 69 66 20 74 68 65 |differen|t if the|
|00002270| 79 20 63 6f 6d 65 0d 61 | 63 72 6f 73 73 20 61 20 |y come.a|cross a |
|00002280| 6d 61 74 72 69 78 20 74 | 68 61 74 20 69 73 20 74 |matrix t|hat is t|
|00002290| 68 65 20 76 65 63 74 6f | 72 20 66 6f 72 6d 2c 20 |he vecto|r form, |
|000022a0| 62 75 74 20 74 68 65 79 | 20 61 72 65 20 72 65 61 |but they| are rea|
|000022b0| 6c 6c 79 20 6a 75 73 74 | 20 61 0d 6e 6f 74 61 74 |lly just| a.notat|
|000022c0| 69 6f 6e 61 6c 20 63 6f | 6e 76 65 6e 69 65 6e 63 |ional co|nvenienc|
|000022d0| 65 2c 20 6e 6f 74 20 61 | 20 66 75 6e 64 61 6d 65 |e, not a| fundame|
|000022e0| 6e 74 61 6c 20 63 68 61 | 6e 67 65 2c 20 61 6e 64 |ntal cha|nge, and|
|000022f0| 20 61 6e 79 74 68 69 6e | 67 20 74 68 61 74 0d 61 | anythin|g that.a|
|00002300| 70 70 6c 69 65 73 20 74 | 6f 20 61 20 6d 61 74 72 |pplies t|o a matr|
|00002310| 69 78 20 61 6c 73 6f 20 | 61 70 70 6c 69 65 73 20 |ix also |applies |
|00002320| 74 6f 20 73 6f 6d 65 74 | 68 69 6e 67 20 74 68 61 |to somet|hing tha|
|00002330| 74 20 77 65 20 74 72 65 | 61 74 20 61 73 20 61 0d |t we tre|at as a.|
|00002340| 76 65 63 74 6f 72 2e 0d | 0d 5c 73 65 63 74 69 6f |vector..|.\sectio|
|00002350| 6e 7b 4d 61 74 72 69 78 | 20 41 74 74 72 69 62 75 |n{Matrix| Attribu|
|00002360| 74 65 73 7d 0d 5c 69 6e | 64 65 78 7b 6d 61 74 72 |tes}.\in|dex{matr|
|00002370| 69 78 21 61 74 74 72 69 | 62 75 74 65 73 7d 0d 5c |ix!attri|butes}.\|
|00002380| 69 6e 64 65 78 7b 61 74 | 74 72 69 62 75 74 65 73 |index{at|tributes|
|00002390| 20 6f 66 20 61 20 6d 61 | 74 72 69 78 7d 0d 0d 54 | of a ma|trix}..T|
|000023a0| 68 65 20 61 74 74 72 69 | 62 75 74 65 73 20 6f 66 |he attri|butes of|
|000023b0| 20 61 20 6d 61 74 72 69 | 78 2c 20 73 75 63 68 20 | a matri|x, such |
|000023c0| 61 73 20 68 6f 77 20 6d | 61 6e 79 20 72 6f 77 73 |as how m|any rows|
|000023d0| 20 69 74 20 68 61 73 2c | 20 61 72 65 0d 61 63 63 | it has,| are.acc|
|000023e0| 65 73 73 69 62 6c 65 20 | 69 6e 20 73 65 76 65 72 |essible |in sever|
|000023f0| 61 6c 20 77 61 79 73 2e | 20 41 6c 6c 20 61 74 74 |al ways.| All att|
|00002400| 72 69 62 75 74 65 73 20 | 61 72 65 20 61 63 63 65 |ributes |are acce|
|00002410| 73 69 62 6c 65 20 74 68 | 72 6f 75 67 68 0d 66 75 |sible th|rough.fu|
|00002420| 6e 63 74 69 6f 6e 20 63 | 61 6c 6c 73 2c 20 66 6f |nction c|alls, fo|
|00002430| 72 20 65 78 61 6d 70 6c | 65 3a 0d 0d 5c 62 65 67 |r exampl|e:..\beg|
|00002440| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0d 3e 20 6d |in{verba|tim}.> m|
|00002450| 79 5f 6d 61 74 72 69 78 | 20 3d 20 5b 20 31 2c 20 |y_matrix| = [ 1, |
|00002460| 30 2e 33 33 33 2c 20 30 | 2e 33 36 37 2c 20 30 2e |0.333, 0|.367, 0.|
|00002470| 32 34 3b 0d 3e 20 20 20 | 20 20 20 20 20 20 20 20 |24;.> | |
|00002480| 20 20 20 20 36 2c 20 2d | 30 2e 33 2c 20 30 2e 39 | 6, -|0.3, 0.9|
|00002490| 2c 20 33 5d 3b 0d 3e 20 | 73 68 6f 77 28 6d 79 5f |, 3];.> |show(my_|
|000024a0| 6d 61 74 72 69 78 29 0d | 20 20 20 6e 61 6d 65 3a |matrix).| name:|
|000024b0| 20 20 20 20 20 20 6d 79 | 5f 6d 61 74 72 69 78 20 | my|_matrix |
|000024c0| 20 0d 20 20 20 63 6c 61 | 73 73 3a 20 20 20 20 20 | . cla|ss: |
|000024d0| 6e 75 6d 20 20 20 20 20 | 20 20 20 0d 20 20 20 74 |num | . t|
|000024e0| 79 70 65 3a 20 20 20 20 | 20 20 72 65 61 6c 20 20 |ype: | real |
|000024f0| 20 20 20 20 20 0d 20 20 | 20 20 20 6e 72 3a 20 20 | . | nr: |
|00002500| 20 20 20 20 32 20 20 20 | 20 20 20 20 20 20 20 0d | 2 | .|
|00002510| 20 20 20 20 20 6e 63 3a | 20 20 20 20 20 20 34 20 | nc:| 4 |
|00002520| 20 20 20 20 20 20 20 20 | 20 0d 3e 20 73 69 7a 65 | | .> size|
|00002530| 28 6d 79 5f 6d 61 74 72 | 69 78 29 0d 20 20 20 20 |(my_matr|ix). |
|00002540| 20 20 20 20 32 20 20 20 | 20 20 20 20 20 20 20 34 | 2 | 4|
|00002550| 20 20 0d 3e 20 6c 65 6e | 67 74 68 28 6d 79 5f 6d | .> len|gth(my_m|
|00002560| 61 74 72 69 78 29 0d 20 | 20 20 20 20 20 20 20 34 |atrix). | 4|
|00002570| 0d 3e 20 63 6c 61 73 73 | 28 6d 79 5f 6d 61 74 72 |.> class|(my_matr|
|00002580| 69 78 29 0d 6e 75 6d 0d | 3e 20 74 79 70 65 28 6d |ix).num.|> type(m|
|00002590| 79 5f 6d 61 74 72 69 78 | 29 0d 72 65 61 6c 0d 3e |y_matrix|).real.>|
|000025a0| 20 6e 61 6d 65 28 6d 79 | 5f 6d 61 74 72 69 78 29 | name(my|_matrix)|
|000025b0| 0d 6d 79 5f 6d 61 74 72 | 69 78 0d 5c 65 6e 64 7b |.my_matr|ix.\end{|
|000025c0| 76 65 72 62 61 74 69 6d | 7d 0d 0d 59 6f 75 20 63 |verbatim|}..You c|
|000025d0| 61 6e 20 6c 65 61 72 6e | 20 6d 6f 72 65 20 61 62 |an learn| more ab|
|000025e0| 6f 75 74 20 65 61 63 68 | 20 6f 66 20 74 68 6f 73 |out each| of thos|
|000025f0| 65 20 66 75 6e 63 74 69 | 6f 6e 73 20 62 79 20 72 |e functi|ons by r|
|00002600| 65 66 65 72 69 6e 67 20 | 74 6f 20 74 68 65 0d 46 |efering |to the.F|
|00002610| 75 6e 63 74 69 6f 6e 20 | 52 65 66 65 72 65 6e 63 |unction |Referenc|
|00002620| 65 2c 20 6f 72 20 62 79 | 20 75 73 69 6e 67 20 74 |e, or by| using t|
|00002630| 68 65 20 6f 6e 2d 6c 69 | 6e 65 20 68 65 6c 70 2e |he on-li|ne help.|
|00002640| 0d 0d 4d 61 74 72 69 78 | 20 61 74 74 72 69 62 75 |..Matrix| attribu|
|00002650| 74 65 73 20 61 72 65 20 | 61 6c 73 6f 20 61 63 63 |tes are |also acc|
|00002660| 65 73 73 69 62 6c 65 20 | 76 69 61 20 61 20 73 68 |essible |via a sh|
|00002670| 6f 72 74 68 61 6e 64 20 | 6e 6f 74 61 74 69 6f 6e |orthand |notation|
|00002680| 3a 0d 0d 5c 62 65 67 69 | 6e 7b 76 65 72 62 61 74 |:..\begi|n{verbat|
|00002690| 69 6d 7d 0d 3e 20 2f 2f | 20 4e 75 6d 62 65 72 20 |im}.> //| Number |
|000026a0| 6f 66 20 72 6f 77 73 0d | 3e 20 6d 79 5f 6d 61 74 |of rows.|> my_mat|
|000026b0| 72 69 78 2e 6e 72 0d 20 | 20 20 20 20 20 20 20 32 |rix.nr. | 2|
|000026c0| 0d 3e 20 2f 2f 20 4e 75 | 6d 62 65 72 20 6f 66 20 |.> // Nu|mber of |
|000026d0| 63 6f 6c 75 6d 6e 73 0d | 3e 20 6d 79 5f 6d 61 74 |columns.|> my_mat|
|000026e0| 72 69 78 2e 6e 63 0d 20 | 20 20 20 20 20 20 20 34 |rix.nc. | 4|
|000026f0| 0d 3e 20 2f 2f 20 4e 75 | 6d 62 65 72 20 6f 66 20 |.> // Nu|mber of |
|00002700| 65 6c 65 6d 65 6e 74 73 | 0d 3e 20 6d 79 5f 6d 61 |elements|.> my_ma|
|00002710| 74 72 69 78 2e 6e 0d 20 | 20 20 20 20 20 20 38 0d |trix.n. | 8.|
|00002720| 3e 20 2f 2f 20 43 6c 61 | 73 73 20 6f 66 20 76 61 |> // Cla|ss of va|
|00002730| 72 69 61 62 6c 65 0d 3e | 20 6d 79 5f 6d 61 74 72 |riable.>| my_matr|
|00002740| 69 78 2e 63 6c 61 73 73 | 0d 6e 75 6d 0d 3e 20 2f |ix.class|.num.> /|
|00002750| 2f 20 54 79 70 65 20 6f | 66 20 63 6f 6e 74 65 6e |/ Type o|f conten|
|00002760| 74 73 0d 3e 20 6d 79 5f | 6d 61 74 72 69 78 2e 74 |ts.> my_|matrix.t|
|00002770| 79 70 65 0d 72 65 61 6c | 0d 5c 65 6e 64 7b 76 65 |ype.real|.\end{ve|
|00002780| 72 62 61 74 69 6d 7d 0d | 0d 5c 73 65 63 74 69 6f |rbatim}.|.\sectio|
|00002790| 6e 7b 52 65 66 65 72 65 | 6e 63 69 6e 67 20 61 20 |n{Refere|ncing a |
|000027a0| 4d 61 74 72 69 78 7d 0d | 0d 49 74 20 64 6f 65 73 |Matrix}.|.It does|
|000027b0| 6e 27 74 20 6d 61 74 74 | 65 72 20 68 6f 77 20 61 |n't matt|er how a|
|000027c0| 20 6d 61 74 72 69 78 20 | 77 61 73 20 63 72 65 61 | matrix |was crea|
|000027d0| 74 65 64 20 2d 20 75 73 | 69 6e 67 20 74 68 65 20 |ted - us|ing the |
|000027e0| 76 65 63 74 6f 72 20 6f | 72 20 6d 61 74 72 69 78 |vector o|r matrix|
|000027f0| 20 0d 6d 65 74 68 6f 64 | 73 2c 20 74 68 65 72 65 | .method|s, there|
|00002800| 20 61 72 65 20 74 77 6f | 20 77 61 79 73 20 74 6f | are two| ways to|
|00002810| 20 61 63 63 65 73 73 20 | 69 74 2e 20 59 6f 75 20 | access |it. You |
|00002820| 63 61 6e 20 65 69 74 68 | 65 72 20 73 70 65 63 69 |can eith|er speci|
|00002830| 66 79 20 61 6e 20 0d 72 | 6f 77 20 61 6e 64 20 63 |fy an .r|ow and c|
|00002840| 6f 6c 75 6d 6e 2c 20 6f | 72 20 79 6f 75 20 63 61 |olumn, o|r you ca|
|00002850| 6e 20 73 70 65 63 69 66 | 79 20 61 20 70 61 72 74 |n specif|y a part|
|00002860| 69 63 75 6c 61 72 20 65 | 6c 65 6d 65 6e 74 2e 20 |icular e|lement. |
|00002870| 46 6f 72 20 65 78 61 6d | 70 6c 65 3a 0d 0d 5c 62 |For exam|ple:..\b|
|00002880| 65 67 69 6e 7b 76 65 72 | 62 61 74 69 6d 7d 0d 3e |egin{ver|batim}.>|
|00002890| 20 61 20 3d 20 72 61 6e | 64 28 33 2c 34 29 0d 20 | a = ran|d(3,4). |
|000028a0| 61 20 3d 0d 20 6d 61 74 | 72 69 78 20 63 6f 6c 75 |a =. mat|rix colu|
|000028b0| 6d 6e 73 20 31 20 74 68 | 72 75 20 34 0d 20 20 20 |mns 1 th|ru 4. |
|000028c0| 20 20 20 20 20 31 20 20 | 20 20 20 20 30 2e 33 33 | 1 | 0.33|
|000028d0| 33 20 20 20 20 20 20 30 | 2e 36 36 35 20 20 20 20 |3 0|.665 |
|000028e0| 20 20 30 2e 31 36 37 20 | 20 0d 20 20 20 20 30 2e | 0.167 | . 0.|
|000028f0| 39 37 35 20 20 20 20 20 | 30 2e 30 33 36 39 20 20 |975 |0.0369 |
|00002900| 20 20 20 30 2e 30 38 34 | 37 20 20 20 20 20 20 30 | 0.084|7 0|
|00002910| 2e 36 35 35 20 20 0d 20 | 20 20 20 30 2e 36 34 37 |.655 . | 0.647|
|00002920| 20 20 20 20 20 20 30 2e | 31 36 32 20 20 20 20 20 | 0.|162 |
|00002930| 20 30 2e 32 30 34 20 20 | 20 20 20 20 30 2e 31 32 | 0.204 | 0.12|
|00002940| 39 20 20 0d 3e 20 61 5b | 31 2c 34 5d 0d 20 20 20 |9 .> a[|1,4]. |
|00002950| 20 30 2e 31 36 37 0d 3e | 20 61 5b 34 5d 0d 20 20 | 0.167.>| a[4]. |
|00002960| 20 20 30 2e 33 33 33 0d | 3e 20 76 20 3d 20 31 3a | 0.333.|> v = 1:|
|00002970| 34 0d 20 76 20 3d 0d 20 | 6d 61 74 72 69 78 20 63 |4. v =. |matrix c|
|00002980| 6f 6c 75 6d 6e 73 20 31 | 20 74 68 72 75 20 34 0d |olumns 1| thru 4.|
|00002990| 20 20 20 20 20 20 20 20 | 31 20 20 20 20 20 20 20 | |1 |
|000029a0| 20 20 20 32 20 20 20 20 | 20 20 20 20 20 20 33 20 | 2 | 3 |
|000029b0| 20 20 20 20 20 20 20 20 | 20 34 20 20 0d 3e 20 76 | | 4 .> v|
|000029c0| 5b 31 3b 33 5d 0d 20 20 | 20 20 20 20 20 20 33 0d |[1;3]. | 3.|
|000029d0| 3e 20 76 5b 32 5d 0d 20 | 20 20 20 20 20 20 20 32 |> v[2]. | 2|
|000029e0| 0d 5c 65 6e 64 7b 76 65 | 72 62 61 74 69 6d 7d 0d |.\end{ve|rbatim}.|
|000029f0| 0d 41 73 20 79 6f 75 20 | 63 61 6e 20 73 65 65 2c |.As you |can see,|
|00002a00| 20 6d 61 74 72 69 63 65 | 73 20 61 72 65 20 73 74 | matrice|s are st|
|00002a10| 6f 72 65 64 20 69 6e 74 | 65 72 6e 61 6c 6c 79 20 |ored int|ernally |
|00002a20| 69 6e 20 61 20 63 6f 6c | 75 6d 6e 2d 77 69 73 65 |in a col|umn-wise|
|00002a30| 0d 66 61 73 68 69 6f 6e | 2e 20 54 6f 20 66 6f 72 |.fashion|. To for|
|00002a40| 63 65 20 61 20 6d 61 74 | 72 69 78 20 74 6f 20 69 |ce a mat|rix to i|
|00002a50| 74 27 73 20 69 6e 74 65 | 72 6e 61 6c 20 66 6f 72 |t's inte|rnal for|
|00002a60| 6d 20 79 6f 75 20 63 61 | 6e 20 75 73 65 20 74 68 |m you ca|n use th|
|00002a70| 65 0d 60 5c 76 65 72 62 | 2b 5b 3a 5d 2b 27 20 6f |e.`\verb|+[:]+' o|
|00002a80| 70 65 72 61 74 6f 72 3a | 0d 0d 5c 62 65 67 69 6e |perator:|..\begin|
|00002a90| 7b 76 65 72 62 61 74 69 | 6d 7d 0d 3e 20 61 20 3d |{verbati|m}.> a =|
|00002aa0| 20 72 61 6e 64 28 32 2c | 33 29 0d 20 61 20 3d 0d | rand(2,|3). a =.|
|00002ab0| 20 6d 61 74 72 69 78 20 | 63 6f 6c 75 6d 6e 73 20 | matrix |columns |
|00002ac0| 31 20 74 68 72 75 20 33 | 0d 20 20 20 20 20 20 20 |1 thru 3|. |
|00002ad0| 20 31 20 20 20 20 20 20 | 30 2e 36 34 37 20 20 20 | 1 |0.647 |
|00002ae0| 20 20 30 2e 30 33 36 39 | 20 20 0d 20 20 20 20 30 | 0.0369| . 0|
|00002af0| 2e 39 37 35 20 20 20 20 | 20 20 30 2e 33 33 33 20 |.975 | 0.333 |
|00002b00| 20 20 20 20 20 30 2e 31 | 36 32 20 20 0d 3e 20 61 | 0.1|62 .> a|
|00002b10| 20 5b 20 3a 20 5d 0d 20 | 6d 61 74 72 69 78 20 63 | [ : ]. |matrix c|
|00002b20| 6f 6c 75 6d 6e 73 20 31 | 20 74 68 72 75 20 31 0d |olumns 1| thru 1.|
|00002b30| 20 20 20 20 20 20 20 20 | 31 20 20 0d 20 20 20 20 | |1 . |
|00002b40| 30 2e 39 37 35 20 20 0d | 20 20 20 20 30 2e 36 34 |0.975 .| 0.64|
|00002b50| 37 20 20 0d 20 20 20 20 | 30 2e 33 33 33 20 20 0d |7 . |0.333 .|
|00002b60| 20 20 20 30 2e 30 33 36 | 39 20 20 0d 20 20 20 20 | 0.036|9 . |
|00002b70| 30 2e 31 36 32 20 20 0d | 5c 65 6e 64 7b 76 65 72 |0.162 .|\end{ver|
|00002b80| 62 61 74 69 6d 7d 0d 0d | 49 6e 20 61 64 64 69 74 |batim}..|In addit|
|00002b90| 69 6f 6e 20 74 6f 20 61 | 63 63 65 73 73 69 6e 67 |ion to a|ccessing|
|00002ba0| 20 73 69 6e 67 6c 65 20 | 65 6c 65 6d 65 6e 74 73 | single |elements|
|00002bb0| 2c 20 77 65 20 63 61 6e | 20 61 6c 73 6f 20 61 63 |, we can| also ac|
|00002bc0| 63 65 73 73 20 70 61 72 | 74 69 61 6c 0d 72 6f 77 |cess par|tial.row|
|00002bd0| 73 20 61 6e 64 2f 6f 72 | 20 63 6f 6c 75 6d 6e 73 |s and/or| columns|
|00002be0| 20 6f 66 20 61 20 6d 61 | 74 72 69 78 2e 20 57 65 | of a ma|trix. We|
|00002bf0| 20 75 73 65 20 74 68 65 | 20 60 5c 76 65 72 62 2b | use the| `\verb+|
|00002c00| 3b 2b 27 20 73 79 6d 62 | 6f 6c 20 74 6f 0d 64 65 |;+' symb|ol to.de|
|00002c10| 6c 69 6d 69 74 20 72 6f | 77 20 61 6e 64 20 63 6f |limit ro|w and co|
|00002c20| 6c 75 6d 6e 20 69 6e 64 | 69 63 69 65 73 2c 20 61 |lumn ind|icies, a|
|00002c30| 6e 64 20 74 68 65 20 60 | 5c 76 65 72 62 2b 2c 2b |nd the `|\verb+,+|
|00002c40| 27 20 73 79 6d 62 6f 6c | 20 74 6f 20 64 65 6c 69 |' symbol| to deli|
|00002c50| 6d 69 74 0d 69 6e 64 69 | 76 69 64 75 61 6c 20 72 |mit.indi|vidual r|
|00002c60| 6f 77 20 6f 72 20 63 6f | 6c 75 6d 6e 20 69 6e 64 |ow or co|lumn ind|
|00002c70| 69 63 69 65 73 2e 0d 54 | 6f 20 72 65 66 65 72 65 |icies..T|o refere|
|00002c80| 6e 63 65 20 61 6e 20 65 | 6e 74 69 72 65 20 72 6f |nce an e|ntire ro|
|00002c90| 77 20 6f 72 20 63 6f 6c | 75 6d 6e 2c 20 77 65 20 |w or col|umn, we |
|00002ca0| 6c 65 61 76 65 20 6f 75 | 74 20 74 68 65 20 63 6f |leave ou|t the co|
|00002cb0| 6c 75 6d 6e 20 6f 72 0d | 72 6f 77 20 69 6e 64 65 |lumn or.|row inde|
|00002cc0| 78 20 72 65 73 70 65 63 | 74 69 76 65 6c 79 3a 0d |x respec|tively:.|
|00002cd0| 0d 5c 62 65 67 69 6e 7b | 76 65 72 62 61 74 69 6d |.\begin{|verbatim|
|00002ce0| 7d 0d 3e 20 67 20 3d 20 | 72 61 6e 64 28 33 2c 34 |}.> g = |rand(3,4|
|00002cf0| 29 0d 20 67 20 3d 0d 20 | 20 20 20 20 20 20 20 31 |). g =. | 1|
|00002d00| 20 20 20 20 20 20 30 2e | 33 33 33 20 20 20 20 20 | 0.|333 |
|00002d10| 20 30 2e 36 36 35 20 20 | 20 20 20 20 30 2e 31 36 | 0.665 | 0.16|
|00002d20| 37 20 20 0d 20 20 20 20 | 30 2e 39 37 35 20 20 20 |7 . |0.975 |
|00002d30| 20 20 30 2e 30 33 36 39 | 20 20 20 20 20 30 2e 30 | 0.0369| 0.0|
|00002d40| 38 34 37 20 20 20 20 20 | 20 30 2e 36 35 35 20 20 |847 | 0.655 |
|00002d50| 0d 20 20 20 20 30 2e 36 | 34 37 20 20 20 20 20 20 |. 0.6|47 |
|00002d60| 30 2e 31 36 32 20 20 20 | 20 20 20 30 2e 32 30 34 |0.162 | 0.204|
|00002d70| 20 20 20 20 20 20 30 2e | 31 32 39 20 20 0d 3e 20 | 0.|129 .> |
|00002d80| 67 5b 33 3b 5d 0d 20 20 | 20 20 30 2e 36 34 37 20 |g[3;]. | 0.647 |
|00002d90| 20 20 20 20 20 30 2e 31 | 36 32 20 20 20 20 20 20 | 0.1|62 |
|00002da0| 30 2e 32 30 34 20 20 20 | 20 20 20 30 2e 31 32 39 |0.204 | 0.129|
|00002db0| 20 20 0d 3e 20 67 5b 3b | 32 5d 0d 20 20 20 20 30 | .> g[;|2]. 0|
|00002dc0| 2e 33 33 33 20 20 0d 20 | 20 20 30 2e 30 33 36 39 |.333 . | 0.0369|
|00002dd0| 20 20 0d 20 20 20 20 30 | 2e 31 36 32 20 20 0d 5c | . 0|.162 .\|
|00002de0| 65 6e 64 7b 76 65 72 62 | 61 74 69 6d 7d 0d 0d 54 |end{verb|atim}..T|
|00002df0| 6f 20 72 65 66 65 72 65 | 6e 63 65 20 61 20 73 75 |o refere|nce a su|
|00002e00| 62 2d 6d 61 74 72 69 78 | 2c 20 77 65 20 6a 75 73 |b-matrix|, we jus|
|00002e10| 74 20 73 70 65 63 69 66 | 79 20 77 68 69 63 68 20 |t specif|y which |
|00002e20| 72 6f 77 73 20 61 6e 64 | 20 63 6f 6c 75 6d 6e 73 |rows and| columns|
|00002e30| 20 61 72 65 0d 74 6f 20 | 62 65 20 65 78 74 72 61 | are.to |be extra|
|00002e40| 63 74 65 64 3a 0d 0d 5c | 62 65 67 69 6e 7b 76 65 |cted:..\|begin{ve|
|00002e50| 72 62 61 74 69 6d 7d 0d | 3e 20 67 5b 32 3b 20 33 |rbatim}.|> g[2; 3|
|00002e60| 2c 34 5d 0d 20 20 20 30 | 2e 30 38 34 37 20 20 20 |,4]. 0|.0847 |
|00002e70| 20 20 20 30 2e 36 35 35 | 20 20 0d 5c 65 6e 64 7b | 0.655| .\end{|
|00002e80| 76 65 72 62 61 74 69 6d | 7d 0d 0d 41 73 20 73 74 |verbatim|}..As st|
|00002e90| 61 74 65 64 20 70 72 65 | 76 69 6f 75 73 6c 79 2c |ated pre|viously,|
|00002ea0| 20 61 6e 79 20 65 78 70 | 72 65 73 73 69 6f 6e 20 | any exp|ression |
|00002eb0| 74 68 61 74 20 65 76 61 | 6c 75 61 74 65 73 20 74 |that eva|luates t|
|00002ec0| 6f 20 61 20 6d 61 74 72 | 69 78 20 63 61 6e 0d 68 |o a matr|ix can.h|
|00002ed0| 61 76 65 20 69 74 27 73 | 20 65 6c 65 6d 65 6e 74 |ave it's| element|
|00002ee0| 73 20 72 65 66 65 72 65 | 6e 63 65 64 2e 20 46 6f |s refere|nced. Fo|
|00002ef0| 72 20 65 78 61 6d 70 6c | 65 2c 20 74 68 65 20 5c |r exampl|e, the \|
|00002f00| 76 65 72 62 2b 73 69 7a | 65 28 29 2b 20 66 75 6e |verb+siz|e()+ fun|
|00002f10| 63 74 69 6f 6e 0d 72 65 | 74 75 72 6e 73 20 61 20 |ction.re|turns a |
|00002f20| 74 77 6f 20 65 6c 65 6d | 65 6e 74 20 6d 61 74 72 |two elem|ent matr|
|00002f30| 69 78 2c 20 77 68 65 72 | 65 20 74 68 65 20 66 69 |ix, wher|e the fi|
|00002f40| 72 73 74 20 65 6c 65 6d | 65 6e 74 20 63 6f 6e 74 |rst elem|ent cont|
|00002f50| 61 69 6e 73 20 74 68 65 | 20 0d 6e 75 6d 62 65 72 |ains the| .number|
|00002f60| 20 6f 66 20 72 6f 77 73 | 20 69 6e 20 74 68 65 20 | of rows| in the |
|00002f70| 61 72 67 75 6d 65 6e 74 | 2c 20 61 6e 64 20 74 68 |argument|, and th|
|00002f80| 65 20 73 65 63 6f 6e 64 | 20 65 6c 65 6d 65 6e 74 |e second| element|
|00002f90| 20 63 6f 6e 74 61 69 6e | 73 20 74 68 65 0d 6e 75 | contain|s the.nu|
|00002fa0| 6d 62 65 72 20 6f 66 20 | 63 6f 6c 75 6d 6e 73 2e |mber of |columns.|
|00002fb0| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 3a 0d 0d 5c | For exa|mple:..\|
|00002fc0| 62 65 67 69 6e 7b 76 65 | 72 62 61 74 69 6d 7d 0d |begin{ve|rbatim}.|
|00002fd0| 3e 20 73 69 7a 65 28 67 | 29 5b 32 5d 0d 20 20 20 |> size(g|)[2]. |
|00002fe0| 20 20 20 20 20 34 0d 5c | 65 6e 64 7b 76 65 72 62 | 4.\|end{verb|
|00002ff0| 61 74 69 6d 7d 0d 0d 0d | 5c 73 65 63 74 69 6f 6e |atim}...|\section|
|00003000| 7b 41 73 73 69 67 6e 6d | 65 6e 74 7d 0d 0d 4a 75 |{Assignm|ent}..Ju|
|00003010| 73 74 20 61 73 20 77 65 | 20 63 61 6e 20 72 65 61 |st as we| can rea|
|00003020| 64 20 66 72 6f 6d 20 70 | 61 72 74 73 20 6f 66 20 |d from p|arts of |
|00003030| 61 20 6d 61 74 72 69 78 | 2c 20 77 65 20 63 61 6e |a matrix|, we can|
|00003040| 20 61 6c 73 6f 20 77 72 | 69 74 65 20 74 6f 20 70 | also wr|ite to p|
|00003050| 61 72 74 0d 6f 66 20 61 | 20 6d 61 74 72 69 78 2e |art.of a| matrix.|
|00003060| 20 20 59 6f 75 20 68 61 | 76 65 20 73 65 65 6e 20 | You ha|ve seen |
|00003070| 61 73 73 69 67 6e 6d 65 | 6e 74 20 6f 66 20 61 20 |assignme|nt of a |
|00003080| 77 68 6f 6c 65 20 6d 61 | 74 72 69 78 20 74 6f 20 |whole ma|trix to |
|00003090| 61 20 76 61 72 69 61 62 | 6c 65 0d 69 6e 20 70 72 |a variab|le.in pr|
|000030a0| 65 76 69 6f 75 73 20 65 | 78 61 6d 70 6c 65 73 20 |evious e|xamples |
|000030b0| 2d 2d 2d 20 6e 6f 77 20 | 6c 65 74 73 20 6c 6f 6f |--- now |lets loo|
|000030c0| 6b 20 61 74 20 70 61 72 | 74 69 61 6c 20 61 73 73 |k at par|tial ass|
|000030d0| 69 67 6e 6d 65 6e 74 2e | 20 57 65 20 63 61 6e 20 |ignment.| We can |
|000030e0| 0d 72 65 2d 61 73 73 69 | 67 6e 20 73 69 6e 67 6c |.re-assi|gn singl|
|000030f0| 65 20 65 6c 65 6d 65 6e | 74 73 2c 20 6f 72 20 67 |e elemen|ts, or g|
|00003100| 72 6f 75 70 73 20 6f 66 | 20 65 6c 65 6d 65 6e 74 |roups of| element|
|00003110| 73 2e 20 46 6f 72 20 73 | 69 6e 67 6c 65 20 65 6c |s. For s|ingle el|
|00003120| 65 6d 65 6e 74 73 2c 0d | 77 65 20 6a 75 73 74 20 |ements,.|we just |
|00003130| 73 70 65 63 69 66 79 20 | 61 20 72 65 66 65 72 65 |specify |a refere|
|00003140| 6e 63 65 20 74 6f 20 74 | 68 61 74 20 65 6c 65 6d |nce to t|hat elem|
|00003150| 65 6e 74 20 28 65 69 74 | 68 65 72 20 72 6f 77 20 |ent (eit|her row |
|00003160| 61 6e 64 20 63 6f 6c 75 | 6d 6e 20 6f 72 20 0d 76 |and colu|mn or .v|
|00003170| 65 63 74 6f 72 20 6e 6f | 74 61 74 69 6f 6e 20 2d |ector no|tation -|
|00003180| 2d 2d 20 69 74 20 64 6f | 65 73 6e 27 74 20 6d 61 |-- it do|esn't ma|
|00003190| 74 74 65 72 29 2c 20 61 | 6e 64 20 65 71 75 61 74 |tter), a|nd equat|
|000031a0| 65 20 69 74 20 74 6f 20 | 74 68 65 20 6e 65 77 20 |e it to |the new |
|000031b0| 76 61 6c 75 65 2e 0d 46 | 6f 72 20 61 20 67 72 6f |value..F|or a gro|
|000031c0| 75 70 20 6f 66 20 65 6c | 65 6d 65 6e 74 73 2c 20 |up of el|ements, |
|000031d0| 77 65 20 68 61 76 65 20 | 74 6f 20 73 70 65 63 69 |we have |to speci|
|000031e0| 66 79 20 61 20 72 61 6e | 67 65 2c 20 61 6e 64 20 |fy a ran|ge, and |
|000031f0| 65 71 75 61 74 65 20 74 | 68 61 74 20 74 6f 0d 61 |equate t|hat to.a|
|00003200| 20 6d 61 74 72 69 78 20 | 6f 66 20 65 71 75 61 6c | matrix |of equal|
|00003210| 20 73 69 7a 65 2e 20 48 | 65 72 65 20 61 72 65 20 | size. H|ere are |
|00003220| 73 6f 6d 65 20 65 78 61 | 6d 70 6c 65 73 3a 0d 0d |some exa|mples:..|
|00003230| 5c 62 65 67 69 6e 7b 76 | 65 72 62 61 74 69 6d 7d |\begin{v|erbatim}|
|00003240| 0d 3e 20 79 65 6c 6c 6f | 77 20 3d 20 72 61 6e 64 |.> yello|w = rand|
|00003250| 28 33 2c 33 29 0d 20 79 | 65 6c 6c 6f 77 20 3d 0d |(3,3). y|ellow =.|
|00003260| 20 20 20 20 30 2e 31 36 | 37 20 20 20 20 20 20 20 | 0.16|7 |
|00003270| 30 2e 39 31 20 20 20 20 | 20 20 30 2e 32 36 35 20 |0.91 | 0.265 |
|00003280| 20 0d 20 20 20 20 30 2e | 36 35 35 20 20 20 20 20 | . 0.|655 |
|00003290| 20 30 2e 31 31 32 20 20 | 20 20 20 20 20 20 30 2e | 0.112 | 0.|
|000032a0| 37 20 20 0d 20 20 20 20 | 30 2e 31 32 39 20 20 20 |7 . |0.129 |
|000032b0| 20 20 20 30 2e 32 39 39 | 20 20 20 20 20 20 20 30 | 0.299| 0|
|000032c0| 2e 39 35 20 20 0d 3e 20 | 79 65 6c 6c 6f 77 5b 32 |.95 .> |yellow[2|
|000032d0| 3b 32 5d 20 3d 20 39 36 | 37 0d 20 79 65 6c 6c 6f |;2] = 96|7. yello|
|000032e0| 77 20 3d 0d 20 20 20 20 | 30 2e 31 36 37 20 20 20 |w =. |0.167 |
|000032f0| 20 20 20 20 30 2e 39 31 | 20 20 20 20 20 20 30 2e | 0.91| 0.|
|00003300| 32 36 35 20 20 0d 20 20 | 20 20 30 2e 36 35 35 20 |265 . | 0.655 |
|00003310| 20 20 20 20 20 20 20 39 | 36 37 20 20 20 20 20 20 | 9|67 |
|00003320| 20 20 30 2e 37 20 20 0d | 20 20 20 20 30 2e 31 32 | 0.7 .| 0.12|
|00003330| 39 20 20 20 20 20 20 30 | 2e 32 39 39 20 20 20 20 |9 0|.299 |
|00003340| 20 20 20 30 2e 39 35 20 | 20 0d 3e 20 79 65 6c 6c | 0.95 | .> yell|
|00003350| 6f 77 5b 32 2c 33 3b 31 | 2c 32 5d 20 3d 20 5b 31 |ow[2,3;1|,2] = [1|
|00003360| 30 30 2c 20 32 30 30 3b | 20 33 30 30 2c 20 34 30 |00, 200;| 300, 40|
|00003370| 30 5d 0d 20 79 65 6c 6c | 6f 77 20 3d 0d 20 20 20 |0]. yell|ow =. |
|00003380| 20 30 2e 31 36 37 20 20 | 20 20 20 20 20 30 2e 39 | 0.167 | 0.9|
|00003390| 31 20 20 20 20 20 20 30 | 2e 32 36 35 20 20 0d 20 |1 0|.265 . |
|000033a0| 20 20 20 20 20 31 30 30 | 20 20 20 20 20 20 20 20 | 100| |
|000033b0| 32 30 30 20 20 20 20 20 | 20 20 20 30 2e 37 20 20 |200 | 0.7 |
|000033c0| 0d 20 20 20 20 20 20 33 | 30 30 20 20 20 20 20 20 |. 3|00 |
|000033d0| 20 20 34 30 30 20 20 20 | 20 20 20 20 30 2e 39 35 | 400 | 0.95|
|000033e0| 20 20 0d 5c 65 6e 64 7b | 76 65 72 62 61 74 69 6d | .\end{|verbatim|
|000033f0| 7d 0d 20 20 0d 5c 73 65 | 63 74 69 6f 6e 7b 4d 61 |}. .\se|ction{Ma|
|00003400| 74 72 69 78 20 4f 70 65 | 72 61 74 69 6f 6e 73 7d |trix Ope|rations}|
|00003410| 0d 0d 54 68 65 20 75 73 | 75 61 6c 20 6d 61 74 68 |..The us|ual math|
|00003420| 65 6d 61 74 69 63 61 6c | 20 6f 70 65 72 61 74 6f |ematical| operato|
|00003430| 72 73 20 28 20 65 67 2e | 20 5c 76 65 72 62 7c 2b |rs ( eg.| \verb|+|
|00003440| 2c 20 2d 2c 20 2a 2c 20 | 2f 7c 20 29 20 20 6f 70 |, -, *, |/| ) op|
|00003450| 65 72 61 74 65 20 6f 6e | 0d 6d 61 74 72 69 63 65 |erate on|.matrice|
|00003460| 73 20 61 73 20 77 65 6c | 6c 20 61 73 20 73 63 61 |s as wel|l as sca|
|00003470| 6c 61 72 73 2e 20 4c 65 | 74 73 20 6c 6f 6f 6b 20 |lars. Le|ts look |
|00003480| 61 74 20 74 68 65 20 76 | 61 72 69 6f 75 73 20 62 |at the v|arious b|
|00003490| 69 6e 61 72 79 20 6f 70 | 65 72 61 74 69 6f 6e 73 |inary op|erations|
|000034a0| 2c 20 0d 66 6f 72 20 5c | 76 65 72 62 2b 41 20 62 |, .for \|verb+A b|
|000034b0| 69 6e 6f 70 20 42 2b 3a | 0d 0d 20 20 20 5c 62 65 |inop B+:|.. \be|
|000034c0| 67 69 6e 7b 64 65 73 63 | 72 69 70 74 69 6f 6e 7d |gin{desc|ription}|
|000034d0| 0d 20 20 20 20 20 5c 69 | 74 65 6d 5b 2b 5d 20 44 |. \i|tem[+] D|
|000034e0| 6f 65 73 20 65 6c 65 6d | 65 6e 74 2d 62 79 2d 65 |oes elem|ent-by-e|
|000034f0| 6c 65 6d 65 6e 74 20 61 | 64 64 69 74 69 6f 6e 20 |lement a|ddition |
|00003500| 6f 66 20 74 77 6f 20 6d | 61 74 72 69 63 65 73 2e |of two m|atrices.|
|00003510| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 54 |. | T|
|00003520| 68 65 20 72 6f 77 20 61 | 6e 64 20 63 6f 6c 75 6d |he row a|nd colum|
|00003530| 6e 20 64 69 6d 65 6e 73 | 69 6f 6e 73 20 6f 66 20 |n dimens|ions of |
|00003540| 5c 76 65 72 62 2b 41 2b | 20 61 6e 64 0d 20 20 20 |\verb+A+| and. |
|00003550| 20 20 20 20 20 20 20 20 | 20 20 20 5c 76 65 72 62 | | \verb|
|00003560| 2b 42 2b 20 6d 75 73 74 | 20 62 65 20 74 68 65 20 |+B+ must| be the |
|00003570| 73 61 6d 65 2c 20 75 6e | 6c 65 73 73 20 65 69 74 |same, un|less eit|
|00003580| 68 65 72 20 5c 76 65 72 | 62 2b 41 2b 20 6f 72 0d |her \ver|b+A+ or.|
|00003590| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 5c 76 | | \v|
|000035a0| 65 72 62 2b 42 2b 20 69 | 73 20 61 20 31 2d 62 79 |erb+B+ i|s a 1-by|
|000035b0| 2d 31 20 6d 61 74 72 69 | 78 3b 20 69 6e 20 74 68 |-1 matri|x; in th|
|000035c0| 69 73 20 63 61 73 65 20 | 61 0d 20 20 20 20 20 20 |is case |a. |
|000035d0| 20 20 20 20 20 20 20 20 | 73 63 61 6c 61 72 2d 6d | |scalar-m|
|000035e0| 61 74 72 69 78 20 61 64 | 64 69 74 69 6f 6e 20 6f |atrix ad|dition o|
|000035f0| 70 65 72 61 74 69 6f 6e | 20 69 73 20 70 65 72 66 |peration| is perf|
|00003600| 6f 72 6d 65 64 2e 0d 0d | 20 20 20 20 20 5c 69 74 |ormed...| \it|
|00003610| 65 6d 5b 2d 2d 5d 20 44 | 6f 65 73 20 65 6c 65 6d |em[--] D|oes elem|
|00003620| 65 6e 74 2d 62 79 2d 65 | 6c 65 6d 65 6e 74 20 73 |ent-by-e|lement s|
|00003630| 75 62 74 72 61 63 74 69 | 6f 6e 20 6f 66 20 74 77 |ubtracti|on of tw|
|00003640| 6f 20 6d 61 74 72 69 63 | 65 73 2e 0d 20 20 20 20 |o matric|es.. |
|00003650| 20 20 20 20 20 20 20 20 | 20 20 54 68 65 20 72 6f | | The ro|
|00003660| 77 20 61 6e 64 20 63 6f | 6c 75 6d 6e 20 64 69 6d |w and co|lumn dim|
|00003670| 65 6e 73 69 6f 6e 73 20 | 6f 66 20 62 6f 74 68 20 |ensions |of both |
|00003680| 5c 76 65 72 62 2b 41 2b | 20 61 6e 64 0d 20 20 20 |\verb+A+| and. |
|00003690| 20 20 20 20 20 20 20 20 | 20 20 20 5c 76 65 72 62 | | \verb|
|000036a0| 2b 42 2b 20 6d 75 73 74 | 20 62 65 20 74 68 65 20 |+B+ must| be the |
|000036b0| 73 61 6d 65 2c 20 75 6e | 6c 65 73 73 20 65 69 74 |same, un|less eit|
|000036c0| 68 65 72 20 5c 76 65 72 | 62 2b 41 2b 20 6f 72 0d |her \ver|b+A+ or.|
|000036d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 5c 76 | | \v|
|000036e0| 65 72 62 2b 42 2b 20 69 | 73 20 61 20 31 2d 62 79 |erb+B+ i|s a 1-by|
|000036f0| 2d 31 20 6d 61 74 72 69 | 78 3b 20 69 6e 20 74 68 |-1 matri|x; in th|
|00003700| 69 73 20 63 61 73 65 20 | 61 0d 20 20 20 20 20 20 |is case |a. |
|00003710| 20 20 20 20 20 20 20 20 | 73 63 61 6c 61 72 2d 6d | |scalar-m|
|00003720| 61 74 72 69 78 20 73 75 | 62 74 72 61 63 74 69 6f |atrix su|btractio|
|00003730| 6e 20 6f 70 65 72 61 74 | 69 6f 6e 20 69 73 20 70 |n operat|ion is p|
|00003740| 65 72 66 6f 72 6d 65 64 | 2e 0d 0d 20 20 20 20 20 |erformed|... |
|00003750| 5c 69 74 65 6d 5b 2a 5d | 20 50 65 72 66 6f 72 6d |\item[*]| Perform|
|00003760| 73 20 6d 61 74 72 69 78 | 20 6d 75 6c 74 69 70 6c |s matrix| multipl|
|00003770| 69 63 61 74 69 6f 6e 20 | 6f 6e 20 74 68 65 20 74 |ication |on the t|
|00003780| 77 6f 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |wo. | |
|00003790| 20 6f 70 65 72 61 6e 64 | 73 2e 20 20 54 68 65 20 | operand|s. The |
|000037a0| 63 6f 6c 75 6d 6e 20 64 | 69 6d 65 6e 73 69 6f 6e |column d|imension|
|000037b0| 20 6f 66 20 7b 5c 76 65 | 72 62 2b 41 2b 7d 20 6d | of {\ve|rb+A+} m|
|000037c0| 75 73 74 20 6d 61 74 63 | 68 0d 20 20 20 20 20 20 |ust matc|h. |
|000037d0| 20 20 20 20 20 20 20 20 | 74 68 65 20 72 6f 77 20 | |the row |
|000037e0| 64 69 6d 65 6e 73 69 6f | 6e 20 6f 66 20 7b 5c 76 |dimensio|n of {\v|
|000037f0| 65 72 62 2b 42 2b 7d 2c | 20 75 6e 6c 65 73 73 20 |erb+B+},| unless |
|00003800| 65 69 74 68 65 72 20 5c | 76 65 72 62 2b 41 2b 20 |either \|verb+A+ |
|00003810| 6f 72 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |or. | |
|00003820| 20 5c 76 65 72 62 2b 42 | 2b 20 69 73 20 61 20 31 | \verb+B|+ is a 1|
|00003830| 2d 62 79 2d 31 20 6d 61 | 74 72 69 78 3b 20 69 6e |-by-1 ma|trix; in|
|00003840| 20 74 68 69 73 20 63 61 | 73 65 20 61 0d 20 20 20 | this ca|se a. |
|00003850| 20 20 20 20 20 20 20 20 | 20 20 20 73 63 61 6c 61 | | scala|
|00003860| 72 2d 6d 61 74 72 69 78 | 20 6d 75 6c 74 69 70 6c |r-matrix| multipl|
|00003870| 69 63 61 74 69 6f 6e 20 | 69 73 20 70 65 72 66 6f |ication |is perfo|
|00003880| 72 6d 65 64 2e 0d 0d 20 | 20 20 20 20 5c 69 74 65 |rmed... | \ite|
|00003890| 6d 5b 2f 5d 20 50 65 72 | 66 6f 72 6d 73 20 6d 61 |m[/] Per|forms ma|
|000038a0| 74 72 69 78 20 60 60 72 | 69 67 68 74 2d 64 69 76 |trix ``r|ight-div|
|000038b0| 69 73 69 6f 6e 27 27 20 | 6f 6e 20 69 74 27 73 20 |ision'' |on it's |
|000038c0| 6f 70 65 72 61 6e 64 73 | 2e 0d 20 20 20 20 20 20 |operands|.. |
|000038d0| 20 20 20 20 20 20 20 20 | 54 68 65 20 6d 61 74 72 | |The matr|
|000038e0| 69 78 20 72 69 67 68 74 | 2d 64 69 76 69 73 69 6f |ix right|-divisio|
|000038f0| 6e 20 28 5c 76 65 72 62 | 2b 41 2f 42 2b 29 20 63 |n (\verb|+A/B+) c|
|00003900| 61 6e 20 62 65 20 74 68 | 6f 75 67 68 74 20 6f 66 |an be th|ought of|
|00003910| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 61 |. | a|
|00003920| 73 20 7b 5c 76 65 72 62 | 2b 41 2a 69 6e 76 20 28 |s {\verb|+A*inv (|
|00003930| 42 29 2b 7d 2e 20 54 68 | 65 20 63 6f 6c 75 6d 6e |B)+}. Th|e column|
|00003940| 20 64 69 6d 65 6e 73 69 | 6f 6e 73 20 6f 66 20 5c | dimensi|ons of \|
|00003950| 76 65 72 62 2b 41 2b 0d | 20 20 20 20 20 20 20 20 |verb+A+.| |
|00003960| 20 20 20 20 20 20 61 6e | 64 20 5c 76 65 72 62 2b | an|d \verb+|
|00003970| 42 2b 20 6d 75 73 74 20 | 62 65 20 74 68 65 20 73 |B+ must |be the s|
|00003980| 61 6d 65 2e 20 49 6e 74 | 65 72 6e 61 6c 6c 79 20 |ame. Int|ernally |
|00003990| 72 69 67 68 74 20 64 69 | 76 69 73 69 6f 6e 0d 20 |right di|vision. |
|000039a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 69 73 20 | | is |
|000039b0| 74 68 65 20 73 61 6d 65 | 20 61 73 20 60 60 6c 65 |the same| as ``le|
|000039c0| 66 74 2d 64 69 76 69 73 | 69 6f 6e 27 27 20 77 69 |ft-divis|ion'' wi|
|000039d0| 74 68 20 74 68 65 20 61 | 72 67 75 6d 65 6e 74 73 |th the a|rguments|
|000039e0| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 74 |. | t|
|000039f0| 72 61 6e 73 70 6f 73 65 | 64 2e 20 0d 0d 20 20 20 |ranspose|d. .. |
|00003a00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 5c 5b 20 | | \[ |
|00003a10| 41 20 2f 20 42 20 3d 20 | 28 20 42 5e 54 20 5c 73 |A / B = |( B^T \s|
|00003a20| 65 74 6d 69 6e 75 73 20 | 41 5e 54 20 29 5e 54 20 |etminus |A^T )^T |
|00003a30| 5c 5d 0d 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |\].. | |
|00003a40| 20 20 54 68 65 20 65 78 | 63 65 70 74 69 6f 6e 20 | The ex|ception |
|00003a50| 74 6f 20 74 68 69 73 20 | 64 69 6d 65 6e 73 69 6f |to this |dimensio|
|00003a60| 6e 20 72 75 6c 65 0d 20 | 20 20 20 20 20 20 20 20 |n rule. | |
|00003a70| 20 20 20 20 20 6f 63 63 | 75 72 73 20 77 68 65 6e | occ|urs when|
|00003a80| 20 5c 76 65 72 62 2b 42 | 2b 20 69 73 20 61 20 31 | \verb+B|+ is a 1|
|00003a90| 2d 62 79 2d 31 20 6d 61 | 74 72 69 78 3b 20 69 6e |-by-1 ma|trix; in|
|00003aa0| 20 74 68 69 73 20 63 61 | 73 65 20 61 0d 20 20 20 | this ca|se a. |
|00003ab0| 20 20 20 20 20 20 20 20 | 20 20 20 6d 61 74 72 69 | | matri|
|00003ac0| 78 2d 73 63 61 6c 61 72 | 20 64 69 76 69 64 65 20 |x-scalar| divide |
|00003ad0| 6f 63 63 75 72 73 2e 0d | 0d 20 20 20 5c 65 6e 64 |occurs..|. \end|
|00003ae0| 7b 64 65 73 63 72 69 70 | 74 69 6f 6e 7d 0d 0d 41 |{descrip|tion}..A|
|00003af0| 64 64 69 74 69 6f 6e 61 | 6c 6c 79 2c 20 5c 52 4c |dditiona|lly, \RL|
|00003b00| 61 42 5c 20 68 61 73 20 | 73 65 76 65 72 61 6c 20 |aB\ has |several |
|00003b10| 6f 74 68 65 72 20 6f 70 | 65 72 61 74 6f 72 73 20 |other op|erators |
|00003b20| 74 68 61 74 20 66 75 6e | 63 74 69 6f 6e 20 6f 6e |that fun|ction on|
|00003b30| 0d 6d 61 74 72 69 78 20 | 6f 70 65 72 61 6e 64 28 |.matrix |operand(|
|00003b40| 73 29 2e 20 0d 0d 20 20 | 20 5c 62 65 67 69 6e 7b |s). .. | \begin{|
|00003b50| 64 65 73 63 72 69 70 74 | 69 6f 6e 7d 0d 20 20 20 |descript|ion}. |
|00003b60| 20 20 5c 69 74 65 6d 5b | 2e 2a 5d 20 50 65 72 66 | \item[|.*] Perf|
|00003b70| 6f 72 6d 73 20 65 6c 65 | 6d 65 6e 74 2d 62 79 2d |orms ele|ment-by-|
|00003b80| 65 6c 65 6d 65 6e 74 20 | 6d 75 6c 74 69 70 6c 69 |element |multipli|
|00003b90| 63 61 74 69 6f 6e 20 6f | 6e 0d 20 20 20 20 20 20 |cation o|n. |
|00003ba0| 20 20 20 20 20 20 20 20 | 69 74 27 73 20 6f 70 65 | |it's ope|
|00003bb0| 72 61 6e 64 73 2e 20 54 | 68 65 20 6f 70 65 72 61 |rands. T|he opera|
|00003bc0| 6e 64 73 20 6d 75 73 74 | 20 68 61 76 65 20 74 68 |nds must| have th|
|00003bd0| 65 20 73 61 6d 65 20 72 | 6f 77 20 61 6e 64 0d 20 |e same r|ow and. |
|00003be0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 63 6f 6c | | col|
|00003bf0| 75 6d 6e 20 64 69 6d 65 | 6e 73 69 6f 6e 73 2c 20 |umn dime|nsions, |
|00003c00| 75 6e 6c 65 73 73 20 65 | 69 74 68 65 72 20 5c 76 |unless e|ither \v|
|00003c10| 65 72 62 2b 41 2b 20 6f | 72 20 5c 76 65 72 62 2b |erb+A+ o|r \verb+|
|00003c20| 42 2b 20 69 73 0d 20 20 | 20 20 20 20 20 20 20 20 |B+ is. | |
|00003c30| 20 20 20 20 61 20 31 2d | 62 79 2d 31 20 6d 61 74 | a 1-|by-1 mat|
|00003c40| 72 69 78 2e 0d 0d 20 20 | 20 20 20 5c 69 74 65 6d |rix... | \item|
|00003c50| 5b 2e 2f 5d 20 50 65 72 | 66 6f 72 6d 73 20 65 6c |[./] Per|forms el|
|00003c60| 65 6d 65 6e 74 2d 62 79 | 2d 65 6c 65 6d 65 6e 74 |ement-by|-element|
|00003c70| 20 64 69 76 69 73 69 6f | 6e 20 6f 6e 20 69 74 27 | divisio|n on it'|
|00003c80| 73 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |s. | |
|00003c90| 6f 70 65 72 61 6e 64 73 | 2e 20 54 68 65 20 6f 70 |operands|. The op|
|00003ca0| 65 72 61 6e 64 73 20 6d | 75 73 74 20 68 61 76 65 |erands m|ust have|
|00003cb0| 20 74 68 65 20 73 61 6d | 65 20 72 6f 77 20 61 6e | the sam|e row an|
|00003cc0| 64 20 63 6f 6c 75 6d 6e | 0d 20 20 20 20 20 20 20 |d column|. |
|00003cd0| 20 20 20 20 20 20 20 64 | 69 6d 65 6e 73 69 6f 6e | d|imension|
|00003ce0| 73 2c 20 75 6e 6c 65 73 | 73 20 65 69 74 68 65 72 |s, unles|s either|
|00003cf0| 20 5c 76 65 72 62 2b 41 | 2b 20 6f 72 20 5c 76 65 | \verb+A|+ or \ve|
|00003d00| 72 62 2b 42 2b 20 69 73 | 20 61 0d 20 20 20 20 20 |rb+B+ is| a. |
|00003d10| 20 20 20 20 20 20 20 20 | 20 31 2d 62 79 2d 31 20 | | 1-by-1 |
|00003d20| 6d 61 74 72 69 78 2e 0d | 0d 20 20 20 20 20 5c 69 |matrix..|. \i|
|00003d30| 74 65 6d 5b 24 5c 73 65 | 74 6d 69 6e 75 73 24 5d |tem[$\se|tminus$]|
|00003d40| 20 50 65 72 66 6f 72 6d | 73 20 6d 61 74 72 69 78 | Perform|s matrix|
|00003d50| 20 60 60 6c 65 66 74 2d | 64 69 76 69 73 69 6f 6e | ``left-|division|
|00003d60| 27 27 2e 20 47 69 76 65 | 6e 0d 20 20 20 20 20 20 |''. Give|n. |
|00003d70| 20 20 20 20 20 20 20 20 | 6f 70 65 72 61 6e 64 73 | |operands|
|00003d80| 20 7b 5c 76 65 72 62 2b | 41 5c 42 2b 7d 2c 20 6d | {\verb+|A\B+}, m|
|00003d90| 61 74 72 69 78 20 6c 65 | 66 74 20 64 69 76 69 73 |atrix le|ft divis|
|00003da0| 69 6f 6e 20 69 73 20 74 | 68 65 0d 20 20 20 20 20 |ion is t|he. |
|00003db0| 20 20 20 20 20 20 20 20 | 20 73 6f 6c 75 74 69 6f | | solutio|
|00003dc0| 6e 20 74 6f 20 74 68 65 | 20 73 65 74 20 6f 66 20 |n to the| set of |
|00003dd0| 65 71 75 61 74 69 6f 6e | 73 20 24 41 78 20 3d 20 |equation|s $Ax = |
|00003de0| 42 24 2e 20 49 66 20 24 | 42 24 20 68 61 73 0d 20 |B$. If $|B$ has. |
|00003df0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 73 65 76 | | sev|
|00003e00| 65 72 61 6c 20 63 6f 6c | 75 6d 6e 73 2c 20 74 68 |eral col|umns, th|
|00003e10| 65 6e 20 65 61 63 68 20 | 63 6f 6c 75 6d 6e 20 6f |en each |column o|
|00003e20| 66 20 24 78 24 20 69 73 | 20 61 20 73 6f 6c 75 74 |f $x$ is| a solut|
|00003e30| 69 6f 6e 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ion. | |
|00003e40| 20 20 74 6f 20 7b 5c 76 | 65 72 62 2b 41 2a 78 5b | to {\v|erb+A*x[|
|00003e50| 3b 69 5d 20 3d 20 42 5b | 3b 69 5d 2b 7d 2e 20 54 |;i] = B[|;i]+}. T|
|00003e60| 68 65 20 72 6f 77 20 64 | 69 6d 65 6e 73 69 6f 6e |he row d|imension|
|00003e70| 73 20 6f 66 0d 20 20 20 | 20 20 20 20 20 20 20 20 |s of. | |
|00003e80| 20 20 20 5c 76 65 72 62 | 2b 41 2b 20 61 6e 64 20 | \verb|+A+ and |
|00003e90| 5c 76 65 72 62 2b 42 2b | 20 6d 75 73 74 20 61 67 |\verb+B+| must ag|
|00003ea0| 72 65 65 2e 0d 0d 20 20 | 20 20 20 5c 69 74 65 6d |ree... | \item|
|00003eb0| 5b 24 2e 5c 73 65 74 6d | 69 6e 75 73 24 5d 20 50 |[$.\setm|inus$] P|
|00003ec0| 65 72 66 6f 72 6d 73 20 | 65 6c 65 6d 65 6e 74 2d |erforms |element-|
|00003ed0| 62 79 2d 65 6c 65 6d 65 | 6e 74 20 6c 65 66 74 2d |by-eleme|nt left-|
|00003ee0| 64 69 76 69 73 69 6f 6e | 2e 0d 20 20 20 20 20 20 |division|.. |
|00003ef0| 20 20 20 20 20 20 20 20 | 45 6c 65 6d 65 6e 74 2d | |Element-|
|00003f00| 62 79 2d 65 6c 65 6d 65 | 6e 74 20 6c 65 66 74 2d |by-eleme|nt left-|
|00003f10| 64 69 76 69 73 69 6f 6e | 20 69 73 20 70 72 6f 76 |division| is prov|
|00003f20| 69 64 65 64 20 66 6f 72 | 0d 20 20 20 20 20 20 20 |ided for|. |
|00003f30| 20 20 20 20 20 20 20 73 | 79 6d 6d 65 74 72 79 2c | s|ymmetry,|
|00003f40| 20 61 6e 64 20 69 73 20 | 65 71 75 69 76 61 6c 65 | and is |equivale|
|00003f50| 6e 74 20 74 6f 20 5c 76 | 65 72 62 2b 42 2e 2f 41 |nt to \v|erb+B./A|
|00003f60| 2b 2e 20 54 68 65 20 72 | 6f 77 20 61 6e 64 0d 20 |+. The r|ow and. |
|00003f70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 63 6f 6c | | col|
|00003f80| 75 6d 6e 20 64 69 6d 65 | 6e 73 69 6f 6e 73 20 6f |umn dime|nsions o|
|00003f90| 66 20 5c 76 65 72 62 2b | 41 2b 20 61 6e 64 20 5c |f \verb+|A+ and \|
|00003fa0| 76 65 72 62 2b 42 2b 20 | 6d 75 73 74 20 61 67 72 |verb+B+ |must agr|
|00003fb0| 65 65 2c 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ee,. | |
|00003fc0| 20 20 75 6e 6c 65 73 73 | 20 65 69 74 68 65 72 20 | unless| either |
|00003fd0| 6f 6e 65 20 69 73 20 61 | 20 31 2d 62 79 2d 31 20 |one is a| 1-by-1 |
|00003fe0| 6d 61 74 72 69 78 2e 0d | 0d 20 20 20 20 20 5c 69 |matrix..|. \i|
|00003ff0| 74 65 6d 5b 24 7b 7d 5e | 5c 77 65 64 67 65 7b 7d |tem[${}^|\wedge{}|
|00004000| 24 5d 20 7b 5c 76 65 72 | 62 2b 41 5e 42 2b 7d 20 |$] {\ver|b+A^B+} |
|00004010| 72 61 69 73 65 73 20 5c | 76 65 72 62 2b 41 2b 20 |raises \|verb+A+ |
|00004020| 74 6f 20 74 68 65 20 5c | 76 65 72 62 2b 42 2b 0d |to the \|verb+B+.|
|00004030| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 70 6f | | po|
|00004040| 77 65 72 2e 20 57 68 65 | 6e 20 5c 76 65 72 62 2b |wer. Whe|n \verb+|
|00004050| 41 2b 20 69 73 20 61 20 | 6d 61 74 72 69 78 2c 20 |A+ is a |matrix, |
|00004060| 61 6e 64 20 5c 76 65 72 | 62 2b 42 2b 20 69 73 20 |and \ver|b+B+ is |
|00004070| 61 6e 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |an. | |
|00004080| 20 69 6e 74 65 67 65 72 | 20 73 63 61 6c 61 72 2c | integer| scalar,|
|00004090| 20 74 68 65 20 6f 70 65 | 72 61 74 69 6f 6e 20 69 | the ope|ration i|
|000040a0| 73 20 70 65 72 66 6f 72 | 6d 65 64 20 62 79 20 73 |s perfor|med by s|
|000040b0| 75 63 63 65 73 73 69 76 | 65 0d 20 20 20 20 20 20 |uccessiv|e. |
|000040c0| 20 20 20 20 20 20 20 20 | 6d 75 6c 74 69 70 6c 69 | |multipli|
|000040d0| 63 61 74 69 6f 6e 73 2e | 20 57 68 65 6e 20 5c 76 |cations.| When \v|
|000040e0| 65 72 62 2b 42 2b 20 69 | 73 20 6e 6f 74 20 61 6e |erb+B+ i|s not an|
|000040f0| 20 69 6e 74 65 67 65 72 | 2c 20 74 68 65 6e 0d 20 | integer|, then. |
|00004100| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 74 68 65 | | the|
|00004110| 20 6f 70 65 72 61 74 69 | 6f 6e 20 69 73 20 70 65 | operati|on is pe|
|00004120| 72 66 6f 72 6d 65 64 20 | 75 73 69 6e 67 20 5c 76 |rformed |using \v|
|00004130| 65 72 62 2b 41 2b 27 73 | 20 65 69 67 65 6e 76 61 |erb+A+'s| eigenva|
|00004140| 6c 75 65 73 0d 20 20 20 | 20 20 20 20 20 20 20 20 |lues. | |
|00004150| 20 20 20 61 6e 64 20 65 | 69 67 65 6e 76 65 63 74 | and e|igenvect|
|00004160| 6f 72 73 2e 20 54 68 65 | 20 6f 70 65 72 61 74 69 |ors. The| operati|
|00004170| 6f 6e 20 69 73 20 6e 6f | 74 20 61 6c 6c 6f 77 65 |on is no|t allowe|
|00004180| 64 20 69 66 0d 20 20 20 | 20 20 20 20 20 20 20 20 |d if. | |
|00004190| 20 20 20 5c 76 65 72 62 | 2b 42 2b 20 69 73 20 61 | \verb|+B+ is a|
|000041a0| 20 6d 61 74 72 69 78 2e | 0d 0d 20 20 20 20 20 5c | matrix.|.. \|
|000041b0| 69 74 65 6d 5b 24 7b 2e | 7d 5e 5c 77 65 64 67 65 |item[${.|}^\wedge|
|000041c0| 7b 7d 24 5d 20 7b 5c 76 | 65 72 62 2b 41 2e 5e 42 |{}$] {\v|erb+A.^B|
|000041d0| 2b 7d 20 72 61 69 73 65 | 73 20 5c 76 65 72 62 2b |+} raise|s \verb+|
|000041e0| 41 2b 20 74 6f 20 74 68 | 65 0d 20 20 20 20 20 20 |A+ to th|e. |
|000041f0| 20 20 20 20 20 20 20 20 | 5c 76 65 72 62 2b 42 2b | |\verb+B+|
|00004200| 20 70 6f 77 65 72 20 69 | 6e 20 61 6e 20 65 6c 65 | power i|n an ele|
|00004210| 6d 65 6e 74 2d 62 79 2d | 65 6c 65 6d 65 6e 74 20 |ment-by-|element |
|00004220| 66 61 73 68 69 6f 6e 2e | 20 45 69 74 68 65 72 0d |fashion.| Either.|
|00004230| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 5c 76 | | \v|
|00004240| 65 72 62 2b 41 2b 20 6f | 72 20 5c 76 65 72 62 2b |erb+A+ o|r \verb+|
|00004250| 42 2b 20 63 61 6e 20 62 | 65 20 6d 61 74 72 69 78 |B+ can b|e matrix|
|00004260| 20 6f 72 20 73 63 61 6c | 61 72 2e 20 49 66 20 62 | or scal|ar. If b|
|00004270| 6f 74 68 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |oth. | |
|00004280| 20 20 5c 76 65 72 62 2b | 41 2b 20 61 6e 64 20 5c | \verb+|A+ and \|
|00004290| 76 65 72 62 2b 42 2b 20 | 61 72 65 20 6d 61 74 72 |verb+B+ |are matr|
|000042a0| 69 63 65 73 2c 20 74 68 | 65 6e 20 74 68 65 20 72 |ices, th|en the r|
|000042b0| 6f 77 20 61 6e 64 0d 20 | 20 20 20 20 20 20 20 20 |ow and. | |
|000042c0| 20 20 20 20 20 63 6f 6c | 75 6d 6e 20 64 69 6d 65 | col|umn dime|
|000042d0| 6e 73 69 6f 6e 73 20 6d | 75 73 74 20 61 67 72 65 |nsions m|ust agre|
|000042e0| 65 2e 0d 0d 20 20 20 20 | 20 5c 69 74 65 6d 5b 27 |e... | \item['|
|000042f0| 5d 20 54 68 69 73 20 75 | 6e 61 72 79 20 6f 70 65 |] This u|nary ope|
|00004300| 72 61 74 6f 72 20 70 65 | 72 66 6f 72 6d 73 20 74 |rator pe|rforms t|
|00004310| 68 65 20 6d 61 74 72 69 | 78 20 74 72 61 6e 73 70 |he matri|x transp|
|00004320| 6f 73 65 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ose. | |
|00004330| 20 20 6f 70 65 72 61 74 | 69 6f 6e 2e 20 5c 76 65 | operat|ion. \ve|
|00004340| 72 62 2b 41 27 2b 20 73 | 77 61 70 73 20 74 68 65 |rb+A'+ s|waps the|
|00004350| 20 72 6f 77 73 20 61 6e | 64 20 63 6f 6c 75 6d 6e | rows an|d column|
|00004360| 73 20 6f 66 20 41 2e 0d | 20 20 20 20 20 20 20 20 |s of A..| |
|00004370| 20 20 20 20 20 20 46 6f | 72 20 61 20 6d 61 74 72 | Fo|r a matr|
|00004380| 69 78 20 77 69 74 68 20 | 63 6f 6d 70 6c 65 78 20 |ix with |complex |
|00004390| 65 6c 65 6d 65 6e 74 73 | 20 61 20 63 6f 6d 70 6c |elements| a compl|
|000043a0| 65 78 20 63 6f 6e 6a 75 | 67 61 74 65 0d 20 20 20 |ex conju|gate. |
|000043b0| 20 20 20 20 20 20 20 20 | 20 20 20 74 72 61 6e 73 | | trans|
|000043c0| 70 6f 73 65 20 69 73 20 | 70 65 72 66 6f 72 6d 65 |pose is |performe|
|000043d0| 64 2e 0d 0d 20 20 20 20 | 20 5c 69 74 65 6d 5b 2e |d... | \item[.|
|000043e0| 27 5d 20 54 68 69 73 20 | 75 6e 61 72 79 20 6f 70 |'] This |unary op|
|000043f0| 65 72 61 74 6f 72 20 70 | 65 72 66 6f 72 6d 73 20 |erator p|erforms |
|00004400| 74 68 65 20 6d 61 74 72 | 69 78 0d 20 20 20 20 20 |the matr|ix. |
|00004410| 20 20 20 20 20 20 20 20 | 20 74 72 61 6e 73 70 6f | | transpo|
|00004420| 73 65 20 6f 70 65 72 61 | 74 69 6f 6e 2e 20 5c 76 |se opera|tion. \v|
|00004430| 65 72 62 2b 41 2e 27 2b | 20 73 77 61 70 73 20 74 |erb+A.'+| swaps t|
|00004440| 68 65 20 72 6f 77 73 20 | 61 6e 64 0d 20 20 20 20 |he rows |and. |
|00004450| 20 20 20 20 20 20 20 20 | 20 20 63 6f 6c 75 6d 6e | | column|
|00004460| 73 20 6f 66 20 41 2e 20 | 20 54 68 65 20 64 69 66 |s of A. | The dif|
|00004470| 66 65 72 65 6e 63 65 20 | 62 65 74 77 65 65 6e 20 |ference |between |
|00004480| 5c 76 65 72 62 2b 27 2b | 20 61 6e 64 0d 20 20 20 |\verb+'+| and. |
|00004490| 20 20 20 20 20 20 20 20 | 20 20 20 5c 76 65 72 62 | | \verb|
|000044a0| 2b 2e 27 2b 20 69 73 20 | 6f 6e 6c 79 20 61 70 70 |+.'+ is |only app|
|000044b0| 61 72 65 6e 74 20 77 68 | 65 6e 20 5c 76 65 72 62 |arent wh|en \verb|
|000044c0| 2b 41 2b 20 69 73 20 61 | 20 63 6f 6d 70 6c 65 78 |+A+ is a| complex|
|000044d0| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 6d |. | m|
|000044e0| 61 74 72 69 78 3b 20 74 | 68 65 6e 20 5c 76 65 72 |atrix; t|hen \ver|
|000044f0| 62 2b 41 2e 27 2b 20 64 | 6f 65 73 20 6e 6f 74 20 |b+A.'+ d|oes not |
|00004500| 70 65 72 66 6f 72 6d 20 | 61 20 63 6f 6d 70 6c 65 |perform |a comple|
|00004510| 78 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |x. | |
|00004520| 63 6f 6e 6a 75 67 61 74 | 65 20 74 72 61 6e 73 70 |conjugat|e transp|
|00004530| 6f 73 65 2e 0d 0d 20 20 | 20 5c 65 6e 64 7b 64 65 |ose... | \end{de|
|00004540| 73 63 72 69 70 74 69 6f | 6e 7d 0d 0d 20 54 68 65 |scriptio|n}.. The|
|00004550| 72 65 20 61 72 65 20 73 | 65 76 65 72 61 6c 20 64 |re are s|everal d|
|00004560| 65 74 61 69 6c 73 20 74 | 68 61 74 20 61 72 65 20 |etails t|hat are |
|00004570| 76 65 72 79 20 69 6d 70 | 6f 72 74 61 6e 74 20 74 |very imp|ortant t|
|00004580| 6f 20 6e 6f 74 65 3a 0d | 0d 20 20 20 5c 62 65 67 |o note:.|. \beg|
|00004590| 69 6e 7b 69 74 65 6d 69 | 7a 65 7d 0d 0d 20 20 20 |in{itemi|ze}.. |
|000045a0| 20 20 5c 69 74 65 6d 20 | 54 68 65 20 6f 70 65 72 | \item |The oper|
|000045b0| 61 74 6f 72 73 20 74 68 | 61 74 20 61 72 65 20 64 |ators th|at are d|
|000045c0| 65 6e 6f 74 65 64 20 62 | 79 20 74 77 6f 20 73 79 |enoted b|y two sy|
|000045d0| 6d 62 6f 6c 20 73 68 6f | 75 6c 64 20 6e 6f 74 0d |mbol sho|uld not.|
|000045e0| 20 20 20 20 20 20 20 20 | 20 20 20 68 61 76 65 20 | | have |
|000045f0| 61 6e 79 20 77 68 69 74 | 65 20 73 70 61 63 65 20 |any whit|e space |
|00004600| 6f 72 20 61 6e 79 20 6f | 74 68 65 72 20 63 68 61 |or any o|ther cha|
|00004610| 72 61 63 74 65 72 20 62 | 65 74 77 65 65 6e 20 74 |racter b|etween t|
|00004620| 68 65 0d 20 20 20 20 20 | 20 20 20 20 20 20 74 77 |he. | tw|
|00004630| 6f 20 73 79 6d 62 6f 6c | 73 2e 0d 0d 20 20 20 20 |o symbol|s... |
|00004640| 20 5c 69 74 65 6d 20 54 | 68 65 20 65 78 70 72 65 | \item T|he expre|
|00004650| 73 73 69 6f 6e 20 5c 76 | 65 72 62 2b 32 2e 2f 41 |ssion \v|erb+2./A|
|00004660| 2b 20 69 73 20 7b 5c 62 | 66 20 6e 6f 74 7d 20 69 |+ is {\b|f not} i|
|00004670| 6e 74 65 72 70 72 65 74 | 65 64 20 61 73 0d 20 20 |nterpret|ed as. |
|00004680| 20 20 20 20 20 20 20 20 | 20 5c 76 65 72 62 2b 32 | | \verb+2|
|00004690| 2e 20 2f 41 2b 2e 20 5c | 52 4c 61 42 5c 20 69 73 |. /A+. \|RLaB\ is|
|000046a0| 20 73 6d 61 72 74 20 65 | 6e 6f 75 67 68 20 74 6f | smart e|nough to|
|000046b0| 20 67 72 6f 75 70 20 74 | 68 65 20 70 65 72 69 6f | group t|he perio|
|000046c0| 64 20 77 69 74 68 0d 20 | 20 20 20 20 20 20 20 20 |d with. | |
|000046d0| 20 20 74 68 65 20 5c 76 | 65 72 62 2b 2f 2b 2e 0d | the \v|erb+/+..|
|000046e0| 0d 20 20 20 5c 65 6e 64 | 7b 69 74 65 6d 69 7a 65 |. \end|{itemize|
|000046f0| 7d 0d 0d 5c 73 65 63 74 | 69 6f 6e 7b 4d 61 74 72 |}..\sect|ion{Matr|
|00004700| 69 78 20 52 65 6c 61 74 | 69 6f 6e 61 6c 20 4f 70 |ix Relat|ional Op|
|00004710| 65 72 61 74 69 6f 6e 73 | 7d 0d 0d 4a 75 73 74 20 |erations|}..Just |
|00004720| 61 73 20 77 65 20 63 61 | 6e 20 70 65 72 66 6f 72 |as we ca|n perfor|
|00004730| 6d 20 72 65 6c 61 74 69 | 6f 6e 61 6c 20 6f 70 65 |m relati|onal ope|
|00004740| 72 61 74 69 6f 6e 73 20 | 6f 6e 20 73 63 61 6c 61 |rations |on scala|
|00004750| 72 73 2c 20 77 65 20 63 | 61 6e 20 61 6c 73 6f 0d |rs, we c|an also.|
|00004760| 64 6f 20 6d 61 74 72 69 | 78 20 72 65 6c 61 74 69 |do matri|x relati|
|00004770| 6f 6e 61 6c 20 6f 70 65 | 72 61 74 69 6f 6e 73 2e |onal ope|rations.|
|00004780| 20 57 68 65 6e 20 77 65 | 20 64 6f 20 61 20 72 65 | When we| do a re|
|00004790| 6c 61 74 69 6f 6e 61 6c | 20 74 65 73 74 20 6f 6e |lational| test on|
|000047a0| 0d 74 77 6f 20 6d 61 74 | 72 69 63 65 73 2c 20 73 |.two mat|rices, s|
|000047b0| 75 63 68 20 61 73 20 5c | 76 65 72 62 2b 41 20 3d |uch as \|verb+A =|
|000047c0| 3d 20 42 2b 2c 20 74 68 | 65 20 6f 70 65 72 61 6e |= B+, th|e operan|
|000047d0| 64 73 20 6d 75 73 74 20 | 62 65 20 74 68 65 20 73 |ds must |be the s|
|000047e0| 61 6d 65 0d 64 69 6d 65 | 6e 73 69 6f 6e 73 2c 20 |ame.dime|nsions, |
|000047f0| 6f 72 20 6f 6e 65 20 6f | 66 20 74 68 65 6d 20 6d |or one o|f them m|
|00004800| 75 73 74 20 62 65 20 61 | 20 31 2d 62 79 2d 31 20 |ust be a| 1-by-1 |
|00004810| 6d 61 74 72 69 78 2e 20 | 20 54 68 65 20 72 65 73 |matrix. | The res|
|00004820| 75 6c 74 20 6f 66 0d 61 | 20 6d 61 74 72 69 78 20 |ult of.a| matrix |
|00004830| 72 65 6c 61 74 69 6f 6e | 61 6c 20 74 65 73 74 20 |relation|al test |
|00004840| 69 73 20 61 20 6d 61 74 | 72 69 78 20 74 68 65 20 |is a mat|rix the |
|00004850| 73 61 6d 65 20 73 69 7a | 65 20 61 73 20 74 68 65 |same siz|e as the|
|00004860| 20 6f 70 65 72 61 6e 64 | 73 0d 66 69 6c 6c 65 64 | operand|s.filled|
|00004870| 20 77 69 74 68 20 6f 6e | 65 73 20 61 6e 64 20 7a | with on|es and z|
|00004880| 65 72 6f 73 20 61 63 63 | 6f 72 64 69 6e 67 20 74 |eros acc|ording t|
|00004890| 6f 20 74 68 65 20 72 65 | 73 75 6c 74 20 6f 66 20 |o the re|sult of |
|000048a0| 61 6e 0d 65 6c 65 6d 65 | 6e 74 2d 62 79 2d 65 6c |an.eleme|nt-by-el|
|000048b0| 65 6d 65 6e 74 20 74 65 | 73 74 2e 20 41 20 6f 6e |ement te|st. A on|
|000048c0| 65 20 69 6e 20 61 20 70 | 61 72 74 69 63 75 6c 61 |e in a p|articula|
|000048d0| 72 20 6c 6f 63 61 74 69 | 6f 6e 20 6d 65 61 6e 73 |r locati|on means|
|000048e0| 20 74 68 65 0d 74 65 73 | 74 20 77 61 73 20 74 72 | the.tes|t was tr|
|000048f0| 75 65 20 66 6f 72 20 74 | 68 65 20 70 61 69 72 20 |ue for t|he pair |
|00004900| 6f 66 20 65 6c 65 6d 65 | 6e 74 73 20 69 6e 20 74 |of eleme|nts in t|
|00004910| 68 6f 73 65 20 6c 6f 63 | 61 74 69 6f 6e 73 20 69 |hose loc|ations i|
|00004920| 6e 20 74 68 65 20 0d 6f | 70 65 72 61 6e 64 73 2e |n the .o|perands.|
|00004930| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 3a 0d 0d 5c | For exa|mple:..\|
|00004940| 62 65 67 69 6e 7b 76 65 | 72 62 61 74 69 6d 7d 0d |begin{ve|rbatim}.|
|00004950| 3e 20 61 20 3d 20 5b 31 | 2c 20 32 2c 20 33 3b 20 |> a = [1|, 2, 3; |
|00004960| 34 2c 20 35 2c 20 36 3b | 20 37 2c 20 38 2c 20 39 |4, 5, 6;| 7, 8, 9|
|00004970| 5d 0d 20 61 20 3d 0d 20 | 6d 61 74 72 69 78 20 63 |]. a =. |matrix c|
|00004980| 6f 6c 75 6d 6e 73 20 31 | 20 74 68 72 75 20 33 0d |olumns 1| thru 3.|
|00004990| 20 20 20 20 20 20 20 20 | 31 20 20 20 20 20 20 20 | |1 |
|000049a0| 20 20 20 32 20 20 20 20 | 20 20 20 20 20 20 33 20 | 2 | 3 |
|000049b0| 20 0d 20 20 20 20 20 20 | 20 20 34 20 20 20 20 20 | . | 4 |
|000049c0| 20 20 20 20 20 35 20 20 | 20 20 20 20 20 20 20 20 | 5 | |
|000049d0| 36 20 20 0d 20 20 20 20 | 20 20 20 20 37 20 20 20 |6 . | 7 |
|000049e0| 20 20 20 20 20 20 20 38 | 20 20 20 20 20 20 20 20 | 8| |
|000049f0| 20 20 39 20 20 0d 3e 20 | 62 20 3d 20 61 27 0d 20 | 9 .> |b = a'. |
|00004a00| 62 20 3d 0d 20 6d 61 74 | 72 69 78 20 63 6f 6c 75 |b =. mat|rix colu|
|00004a10| 6d 6e 73 20 31 20 74 68 | 72 75 20 33 0d 20 20 20 |mns 1 th|ru 3. |
|00004a20| 20 20 20 20 20 31 20 20 | 20 20 20 20 20 20 20 20 | 1 | |
|00004a30| 34 20 20 20 20 20 20 20 | 20 20 20 37 20 20 0d 20 |4 | 7 . |
|00004a40| 20 20 20 20 20 20 20 32 | 20 20 20 20 20 20 20 20 | 2| |
|00004a50| 20 20 35 20 20 20 20 20 | 20 20 20 20 20 38 20 20 | 5 | 8 |
|00004a60| 0d 20 20 20 20 20 20 20 | 20 33 20 20 20 20 20 20 |. | 3 |
|00004a70| 20 20 20 20 36 20 20 20 | 20 20 20 20 20 20 20 39 | 6 | 9|
|00004a80| 20 20 0d 3e 20 61 20 3d | 3d 20 62 0d 20 6d 61 74 | .> a =|= b. mat|
|00004a90| 72 69 78 20 63 6f 6c 75 | 6d 6e 73 20 31 20 74 68 |rix colu|mns 1 th|
|00004aa0| 72 75 20 33 0d 20 20 20 | 20 20 20 20 20 31 20 20 |ru 3. | 1 |
|00004ab0| 20 20 20 20 20 20 20 20 | 30 20 20 20 20 20 20 20 | |0 |
|00004ac0| 20 20 20 30 20 20 0d 20 | 20 20 20 20 20 20 20 30 | 0 . | 0|
|00004ad0| 20 20 20 20 20 20 20 20 | 20 20 31 20 20 20 20 20 | | 1 |
|00004ae0| 20 20 20 20 20 30 20 20 | 0d 20 20 20 20 20 20 20 | 0 |. |
|00004af0| 20 30 20 20 20 20 20 20 | 20 20 20 20 30 20 20 20 | 0 | 0 |
|00004b00| 20 20 20 20 20 20 20 31 | 20 20 0d 3e 20 61 20 3e | 1| .> a >|
|00004b10| 3d 20 35 0d 20 6d 61 74 | 72 69 78 20 63 6f 6c 75 |= 5. mat|rix colu|
|00004b20| 6d 6e 73 20 31 20 74 68 | 72 75 20 33 0d 20 20 20 |mns 1 th|ru 3. |
|00004b30| 20 20 20 20 20 30 20 20 | 20 20 20 20 20 20 20 20 | 0 | |
|00004b40| 30 20 20 20 20 20 20 20 | 20 20 20 30 20 20 0d 20 |0 | 0 . |
|00004b50| 20 20 20 20 20 20 20 30 | 20 20 20 20 20 20 20 20 | 0| |
|00004b60| 20 20 31 20 20 20 20 20 | 20 20 20 20 20 31 20 20 | 1 | 1 |
|00004b70| 0d 20 20 20 20 20 20 20 | 20 31 20 20 20 20 20 20 |. | 1 |
|00004b80| 20 20 20 20 31 20 20 20 | 20 20 20 20 20 20 20 31 | 1 | 1|
|00004b90| 20 20 0d 5c 65 6e 64 7b | 76 65 72 62 61 74 69 6d | .\end{|verbatim|
|00004ba0| 7d 0d 0d 5c 52 4c 61 42 | 5c 20 69 66 2d 74 65 73 |}..\RLaB|\ if-tes|
|00004bb0| 74 73 20 64 6f 20 6e 6f | 74 20 61 63 63 65 70 74 |ts do no|t accept|
|00004bc0| 20 6d 61 74 72 69 63 65 | 73 2e 20 54 68 65 20 5c | matrice|s. The \|
|00004bd0| 76 65 72 62 2b 61 6e 79 | 28 29 2b 20 61 6e 64 0d |verb+any|()+ and.|
|00004be0| 5c 76 65 72 62 2b 61 6c | 6c 28 29 2b 20 66 75 6e |\verb+al|l()+ fun|
|00004bf0| 63 74 69 6f 6e 73 20 63 | 61 6e 20 62 65 20 75 73 |ctions c|an be us|
|00004c00| 65 64 20 69 6e 20 63 6f | 6d 62 69 6e 61 74 69 6f |ed in co|mbinatio|
|00004c10| 6e 20 77 69 74 68 20 72 | 65 6c 61 74 69 6f 6e 61 |n with r|elationa|
|00004c20| 6c 0d 61 6e 64 20 6c 6f | 67 69 63 61 6c 20 74 65 |l.and lo|gical te|
|00004c30| 73 74 73 20 74 6f 20 63 | 6f 6e 64 69 74 69 6f 6e |sts to c|ondition|
|00004c40| 61 6c 6c 79 20 65 78 65 | 63 75 74 65 20 73 74 61 |ally exe|cute sta|
|00004c50| 74 65 6d 65 6e 74 73 20 | 62 61 73 65 64 20 75 70 |tements |based up|
|00004c60| 6f 6e 0d 6d 61 74 72 69 | 78 20 70 72 6f 70 65 72 |on.matri|x proper|
|00004c70| 74 69 65 73 2e 20 0d 0d | 54 68 65 20 66 75 6e 63 |ties. ..|The func|
|00004c80| 74 69 6f 6e 20 5c 76 65 | 72 62 2b 61 6e 79 28 29 |tion \ve|rb+any()|
|00004c90| 2b 20 72 65 74 75 72 6e | 73 20 74 72 75 65 20 69 |+ return|s true i|
|00004ca0| 66 20 61 6e 79 20 6f 66 | 20 74 68 65 20 65 6c 65 |f any of| the ele|
|00004cb0| 6d 65 6e 74 73 20 6f 66 | 0d 69 74 27 73 20 61 72 |ments of|.it's ar|
|00004cc0| 67 75 6d 65 6e 74 20 61 | 72 65 20 6e 6f 6e 2d 7a |gument a|re non-z|
|00004cd0| 65 72 6f 2e 20 54 68 65 | 20 66 75 6e 63 74 69 6f |ero. The| functio|
|00004ce0| 6e 20 5c 76 65 72 62 2b | 61 6c 6c 28 29 2b 20 72 |n \verb+|all()+ r|
|00004cf0| 65 74 75 72 6e 73 20 74 | 72 75 65 0d 69 66 20 61 |eturns t|rue.if a|
|00004d00| 6c 6c 20 6f 66 20 74 68 | 65 20 65 6c 65 6d 65 6e |ll of th|e elemen|
|00004d10| 74 73 20 6f 66 20 69 74 | 27 73 20 61 72 67 75 6d |ts of it|'s argum|
|00004d20| 65 6e 74 20 61 72 65 20 | 6e 6f 6e 2d 7a 65 72 6f |ent are |non-zero|
|00004d30| 2e 20 20 54 68 65 20 5c | 76 65 72 62 2b 61 6e 79 |. The \|verb+any|
|00004d40| 28 29 2b 0d 66 75 6e 63 | 74 69 6f 6e 20 69 73 20 |()+.func|tion is |
|00004d50| 63 61 6c 6c 65 64 20 6f | 6e 20 74 68 65 20 6f 75 |called o|n the ou|
|00004d60| 74 70 75 74 20 6f 66 20 | 61 6e 6f 74 68 65 72 20 |tput of |another |
|00004d70| 5c 76 65 72 62 2b 61 6e | 79 28 29 2b 20 63 61 6c |\verb+an|y()+ cal|
|00004d80| 6c 20 62 65 63 61 75 73 | 65 20 74 68 65 0d 5c 76 |l becaus|e the.\v|
|00004d90| 65 72 62 2b 61 6e 79 28 | 29 2b 20 66 75 6e 63 74 |erb+any(|)+ funct|
|00004da0| 69 6f 6e 20 72 65 74 75 | 72 6e 73 20 61 20 76 65 |ion retu|rns a ve|
|00004db0| 63 74 6f 72 20 77 68 65 | 6e 20 70 61 73 73 65 64 |ctor whe|n passed|
|00004dc0| 20 61 20 6d 61 74 72 69 | 78 20 74 68 61 74 20 69 | a matri|x that i|
|00004dd0| 73 20 6e 6f 74 0d 61 6c | 72 65 61 64 79 20 61 20 |s not.al|ready a |
|00004de0| 76 65 63 74 6f 72 2e 20 | 20 0d 0d 5c 73 65 63 74 |vector. | ..\sect|
|00004df0| 69 6f 6e 7b 46 75 6e 63 | 74 69 6f 6e 73 7d 0d 0d |ion{Func|tions}..|
|00004e00| 59 6f 75 20 68 61 76 65 | 20 61 6c 72 65 61 64 79 |You have| already|
|00004e10| 20 73 65 65 6e 20 73 6f | 6d 65 20 6f 66 20 74 68 | seen so|me of th|
|00004e20| 65 20 66 75 6e 63 74 69 | 6f 6e 73 20 69 6e 20 75 |e functi|ons in u|
|00004e30| 73 65 2e 20 20 54 68 65 | 72 65 20 61 72 65 20 66 |se. The|re are f|
|00004e40| 6f 72 0d 62 61 73 69 63 | 20 74 79 70 65 73 20 6f |or.basic| types o|
|00004e50| 66 20 66 75 6e 63 74 69 | 6f 6e 73 20 74 68 61 74 |f functi|ons that|
|00004e60| 20 63 61 6e 20 6f 70 65 | 72 61 74 65 20 6f 6e 20 | can ope|rate on |
|00004e70| 6d 61 74 72 69 63 69 65 | 73 20 69 6e 20 5c 52 4c |matricie|s in \RL|
|00004e80| 61 42 5c 2e 20 54 68 65 | 79 0d 61 72 65 3a 20 0d |aB\. The|y.are: .|
|00004e90| 20 20 20 5c 62 65 67 69 | 6e 7b 64 65 73 63 72 69 | \begi|n{descri|
|00004ea0| 70 74 69 6f 6e 7d 0d 0d | 20 20 20 20 20 5c 69 74 |ption}..| \it|
|00004eb0| 65 6d 5b 53 63 61 6c 61 | 72 20 46 75 6e 63 74 69 |em[Scala|r Functi|
|00004ec0| 6f 6e 73 3a 5d 20 54 68 | 65 73 65 20 66 75 6e 63 |ons:] Th|ese func|
|00004ed0| 74 69 6f 6e 73 20 6f 70 | 65 72 61 74 65 20 6f 6e |tions op|erate on|
|00004ee0| 20 73 63 61 6c 61 72 73 | 2c 20 61 6e 64 0d 20 20 | scalars|, and. |
|00004ef0| 20 20 20 20 20 20 20 20 | 20 74 72 65 61 74 20 6d | | treat m|
|00004f00| 61 74 72 69 63 65 73 20 | 69 6e 20 61 6e 20 65 6c |atrices |in an el|
|00004f10| 65 6d 65 6e 74 2d 62 79 | 2d 65 6c 65 6d 65 6e 74 |ement-by|-element|
|00004f20| 20 66 61 73 68 69 6f 6e | 2e 20 53 6f 6d 65 0d 20 | fashion|. Some. |
|00004f30| 20 20 20 20 20 20 20 20 | 20 20 65 78 61 6d 70 6c | | exampl|
|00004f40| 65 73 20 61 72 65 3a 0d | 0d 20 20 20 20 20 20 20 |es are:.|. |
|00004f50| 20 20 20 20 5c 62 65 67 | 69 6e 7b 74 61 62 62 69 | \beg|in{tabbi|
|00004f60| 6e 67 7d 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ng}. | |
|00004f70| 20 66 75 6e 63 74 69 6f | 6e 31 20 5c 3d 20 66 75 | functio|n1 \= fu|
|00004f80| 6e 63 74 69 6f 6e 32 20 | 5c 3d 20 66 75 6e 63 74 |nction2 |\= funct|
|00004f90| 69 6f 6e 32 20 5c 3d 20 | 66 75 6e 63 74 69 6f 6e |ion2 \= |function|
|00004fa0| 34 20 5c 6b 69 6c 6c 20 | 20 20 20 20 20 20 20 0d |4 \kill | .|
|00004fb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 61 62 73 | | abs|
|00004fc0| 20 5c 3e 20 65 78 70 20 | 5c 3e 20 66 6c 6f 6f 72 | \> exp |\> floor|
|00004fd0| 20 5c 3e 20 72 6f 75 6e | 64 20 5c 5c 0d 20 20 20 | \> roun|d \\. |
|00004fe0| 20 20 20 20 20 20 20 20 | 20 20 63 6f 73 20 5c 3e | | cos \>|
|00004ff0| 20 73 69 6e 20 5c 3e 20 | 74 61 6e 20 5c 3e 20 63 | sin \> |tan \> c|
|00005000| 65 69 6c 20 5c 5c 0d 20 | 20 20 20 20 20 20 20 20 |eil \\. | |
|00005010| 20 20 20 20 73 71 72 74 | 20 5c 3e 20 72 65 61 6c | sqrt| \> real|
|00005020| 20 5c 3e 20 69 6d 61 67 | 20 5c 3e 20 63 6f 6e 6a | \> imag| \> conj|
|00005030| 20 5c 5c 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 | \\. | |
|00005040| 20 69 73 6e 61 6e 20 5c | 3e 20 69 6e 74 20 5c 3e | isnan \|> int \>|
|00005050| 20 5c 3e 20 5c 5c 0d 20 | 20 20 20 20 20 20 20 20 | \> \\. | |
|00005060| 20 20 5c 65 6e 64 7b 74 | 61 62 62 69 6e 67 7d 0d | \end{t|abbing}.|
|00005070| 0d 20 20 20 20 20 5c 69 | 74 65 6d 5b 56 65 63 74 |. \i|tem[Vect|
|00005080| 6f 72 20 46 75 6e 63 74 | 69 6f 6e 73 3a 5d 20 54 |or Funct|ions:] T|
|00005090| 68 65 73 65 20 66 75 6e | 63 74 69 6f 6e 73 20 6f |hese fun|ctions o|
|000050a0| 70 65 72 61 74 65 20 6f | 6e 20 76 65 63 74 6f 72 |perate o|n vector|
|000050b0| 73 2c 0d 20 20 20 20 20 | 20 20 20 20 20 20 65 69 |s,. | ei|
|000050c0| 74 68 65 72 20 72 6f 77 | 2d 76 65 63 74 6f 72 73 |ther row|-vectors|
|000050d0| 20 28 31 2d 62 79 2d 24 | 6e 24 29 20 6f 72 20 63 | (1-by-$|n$) or c|
|000050e0| 6f 6c 75 6d 6e 20 76 65 | 63 74 6f 72 73 20 28 24 |olumn ve|ctors ($|
|000050f0| 6d 24 2d 62 79 2d 31 29 | 2c 0d 20 20 20 20 20 20 |m$-by-1)|,. |
|00005100| 20 20 20 20 20 69 6e 20 | 74 68 65 20 73 61 6d 65 | in |the same|
|00005110| 20 66 61 73 68 69 6f 6e | 2e 20 20 49 66 20 74 68 | fashion|. If th|
|00005120| 65 20 61 72 67 75 6d 65 | 6e 74 20 69 73 20 61 20 |e argume|nt is a |
|00005130| 6d 61 74 72 69 78 20 77 | 69 74 68 20 62 6f 74 68 |matrix w|ith both|
|00005140| 0d 20 20 20 20 20 20 20 | 20 20 20 20 64 69 6d 65 |. | dime|
|00005150| 6e 73 69 6f 6e 73 20 24 | 3e 20 31 24 20 74 68 65 |nsions $|> 1$ the|
|00005160| 6e 20 74 68 65 20 6f 70 | 65 72 61 74 69 6f 6e 20 |n the op|eration |
|00005170| 69 73 20 70 65 72 66 6f | 72 6d 65 64 20 69 6e 20 |is perfo|rmed in |
|00005180| 61 0d 20 20 20 20 20 20 | 20 20 20 20 20 63 6f 6c |a. | col|
|00005190| 75 6d 6e 2d 77 69 73 65 | 20 66 61 73 68 69 6f 6e |umn-wise| fashion|
|000051a0| 2e 20 53 6f 6d 65 20 65 | 78 61 6d 70 6c 65 73 20 |. Some e|xamples |
|000051b0| 61 72 65 3a 20 0d 0d 20 | 20 20 20 20 20 20 20 20 |are: .. | |
|000051c0| 20 20 5c 62 65 67 69 6e | 7b 74 61 62 62 69 6e 67 | \begin|{tabbing|
|000051d0| 7d 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 66 |}. | f|
|000051e0| 75 6e 63 74 69 6f 6e 31 | 20 5c 3d 20 66 75 6e 63 |unction1| \= func|
|000051f0| 74 69 6f 6e 32 20 5c 3d | 20 66 75 6e 63 74 69 6f |tion2 \=| functio|
|00005200| 6e 32 20 5c 3d 20 66 75 | 6e 63 74 69 6f 6e 34 20 |n2 \= fu|nction4 |
|00005210| 5c 6b 69 6c 6c 20 20 20 | 20 20 20 20 20 0d 20 20 |\kill | . |
|00005220| 20 20 20 20 20 20 20 20 | 20 20 20 73 75 6d 20 5c | | sum \|
|00005230| 3e 20 70 72 6f 64 20 5c | 3e 20 6d 65 61 6e 20 5c |> prod \|> mean \|
|00005240| 3e 20 6d 61 78 20 5c 5c | 0d 20 20 20 20 20 20 20 |> max \\|. |
|00005250| 20 20 20 20 20 20 6d 69 | 6e 20 5c 3e 20 66 66 74 | mi|n \> fft|
|00005260| 20 5c 3e 20 73 6f 72 74 | 20 5c 3e 20 61 6e 79 20 | \> sort| \> any |
|00005270| 5c 5c 0d 20 20 20 20 20 | 20 20 20 20 20 20 5c 65 |\\. | \e|
|00005280| 6e 64 7b 74 61 62 62 69 | 6e 67 7d 0d 0d 20 20 20 |nd{tabbi|ng}.. |
|00005290| 20 20 20 20 20 20 20 20 | 57 68 65 6e 20 75 73 69 | |When usi|
|000052a0| 6e 67 20 61 20 76 65 63 | 74 6f 72 20 6f 72 69 65 |ng a vec|tor orie|
|000052b0| 6e 74 65 64 20 66 75 6e | 63 74 69 6f 6e 2c 20 6c |nted fun|ction, l|
|000052c0| 69 6b 65 20 5c 76 65 72 | 62 2b 6d 61 78 28 29 2b |ike \ver|b+max()+|
|000052d0| 2c 0d 20 20 20 20 20 20 | 20 20 20 20 20 6f 6e 20 |,. | on |
|000052e0| 61 20 67 65 6e 65 72 61 | 6c 20 6d 61 74 72 69 78 |a genera|l matrix|
|000052f0| 2c 20 69 74 20 69 73 20 | 70 6f 73 73 69 62 6c 65 |, it is |possible|
|00005300| 20 74 6f 20 6f 62 74 61 | 69 6e 20 73 63 61 6c 61 | to obta|in scala|
|00005310| 72 0d 20 20 20 20 20 20 | 20 20 20 20 20 71 75 61 |r. | qua|
|00005320| 6e 74 69 74 69 65 73 2e | 20 46 6f 72 20 65 78 61 |ntities.| For exa|
|00005330| 6d 70 6c 65 20 74 68 65 | 20 6d 61 78 69 6d 75 6d |mple the| maximum|
|00005340| 20 76 61 6c 75 65 20 69 | 6e 20 61 20 6d 61 74 72 | value i|n a matr|
|00005350| 69 78 20 63 61 6e 0d 20 | 20 20 20 20 20 20 20 20 |ix can. | |
|00005360| 20 20 62 65 20 6f 62 74 | 61 69 6e 65 64 20 75 73 | be obt|ained us|
|00005370| 69 6e 67 20 5c 76 65 72 | 62 2b 6d 61 78 20 28 6d |ing \ver|b+max (m|
|00005380| 61 78 20 28 61 29 29 2b | 2e 20 54 68 65 20 66 69 |ax (a))+|. The fi|
|00005390| 72 73 74 20 63 61 6c 6c | 20 74 6f 0d 20 20 20 20 |rst call| to. |
|000053a0| 20 20 20 20 20 20 20 5c | 76 65 72 62 2b 6d 61 78 | \|verb+max|
|000053b0| 28 29 2b 20 72 65 74 75 | 72 6e 73 20 61 20 76 65 |()+ retu|rns a ve|
|000053c0| 63 74 6f 72 20 6f 66 20 | 74 68 65 20 6d 61 78 69 |ctor of |the maxi|
|000053d0| 6d 75 6d 20 76 61 6c 75 | 65 73 20 66 72 6f 6d 0d |mum valu|es from.|
|000053e0| 20 20 20 20 20 20 20 20 | 20 20 20 65 61 63 68 20 | | each |
|000053f0| 63 6f 6c 75 6d 6e 2c 20 | 61 6e 64 20 74 68 65 20 |column, |and the |
|00005400| 73 65 63 6f 6e 64 20 63 | 61 6c 6c 20 74 6f 20 5c |second c|all to \|
|00005410| 76 65 72 62 2b 6d 61 78 | 28 29 2b 20 72 65 74 75 |verb+max|()+ retu|
|00005420| 72 6e 73 0d 20 20 20 20 | 20 20 20 20 20 20 20 74 |rns. | t|
|00005430| 68 65 20 6d 61 78 69 6d | 75 6d 20 76 61 6c 75 65 |he maxim|um value|
|00005440| 20 69 6e 20 74 68 65 20 | 6d 61 74 72 69 78 2e 20 | in the |matrix. |
|00005450| 20 0d 0d 20 20 20 20 20 | 5c 69 74 65 6d 5b 4d 61 | .. |\item[Ma|
|00005460| 74 72 69 78 20 46 75 6e | 63 74 69 6f 6e 73 3a 5d |trix Fun|ctions:]|
|00005470| 20 54 68 65 73 65 20 66 | 75 6e 63 74 69 6f 6e 73 | These f|unctions|
|00005480| 20 6f 70 65 72 61 74 65 | 20 6f 6e 20 6d 61 74 72 | operate| on matr|
|00005490| 69 63 65 73 20 61 73 20 | 61 0d 20 20 20 20 20 20 |ices as |a. |
|000054a0| 20 20 20 20 20 73 69 6e | 67 6c 65 20 65 6e 74 69 | sin|gle enti|
|000054b0| 74 79 2e 20 53 6f 6d 65 | 20 65 78 61 6d 70 6c 65 |ty. Some| example|
|000054c0| 73 20 61 72 65 3a 0d 0d | 20 20 20 20 20 20 20 20 |s are:..| |
|000054d0| 20 20 20 5c 62 65 67 69 | 6e 7b 74 61 62 62 69 6e | \begi|n{tabbin|
|000054e0| 67 7d 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |g}. | |
|000054f0| 66 75 6e 63 74 69 6f 6e | 31 20 5c 3d 20 66 75 6e |function|1 \= fun|
|00005500| 63 74 69 6f 6e 32 20 5c | 3d 20 66 75 6e 63 74 69 |ction2 \|= functi|
|00005510| 6f 6e 32 20 5c 3d 20 66 | 75 6e 63 74 69 6f 6e 34 |on2 \= f|unction4|
|00005520| 20 5c 6b 69 6c 6c 20 20 | 20 20 20 20 20 20 0d 20 | \kill | . |
|00005530| 20 20 20 20 20 20 20 20 | 20 20 20 20 62 61 6c 61 | | bala|
|00005540| 6e 63 65 20 5c 3e 20 63 | 68 6f 6c 20 5c 3e 20 64 |nce \> c|hol \> d|
|00005550| 65 74 20 5c 3e 20 65 69 | 67 20 5c 5c 0d 20 20 20 |et \> ei|g \\. |
|00005560| 20 20 20 20 20 20 20 20 | 20 20 68 65 73 73 20 5c | | hess \|
|00005570| 3e 20 69 6e 76 20 5c 3e | 20 6c 75 20 5c 3e 20 6e |> inv \>| lu \> n|
|00005580| 6f 72 6d 20 5c 5c 0d 20 | 20 20 20 20 20 20 20 20 |orm \\. | |
|00005590| 20 20 20 20 70 69 6e 76 | 20 5c 3e 20 71 72 20 5c | pinv| \> qr \|
|000055a0| 3e 20 72 61 6e 6b 20 5c | 3e 20 72 63 6f 6e 64 20 |> rank \|> rcond |
|000055b0| 5c 5c 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |\\. | |
|000055c0| 72 65 73 68 61 70 65 20 | 5c 3e 20 73 6f 6c 76 65 |reshape |\> solve|
|000055d0| 20 5c 3e 20 73 76 64 20 | 5c 3e 20 73 79 6d 6d 20 | \> svd |\> symm |
|000055e0| 5c 5c 0d 20 20 20 20 20 | 20 20 20 20 20 20 5c 65 |\\. | \e|
|000055f0| 6e 64 7b 74 61 62 62 69 | 6e 67 7d 0d 0d 20 20 20 |nd{tabbi|ng}.. |
|00005600| 5c 65 6e 64 7b 64 65 73 | 63 72 69 70 74 69 6f 6e |\end{des|cription|
|00005610| 7d 0d 0d 0d 5c 69 6e 64 | 65 78 7b 6d 61 74 72 69 |}...\ind|ex{matri|
|00005620| 63 69 65 73 7c 29 7d 0d | 0d 0d 0d 0d 0d |cies|)}.|..... |
+--------+-------------------------+-------------------------+--------+--------+